Use MPU9250 with nRF51822

Dependencies:   eMPL_MPU

Fork of Seeed_Tiny_BLE_Flash by Darren Huang

Committer:
yihui
Date:
Thu Dec 10 08:00:18 2015 +0000
Revision:
5:9b240c1d5251
get 9dof data from mpu9250

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 5:9b240c1d5251 1 /* mbed Microcontroller Library
yihui 5:9b240c1d5251 2 * Copyright (c) 2006-2013 ARM Limited
yihui 5:9b240c1d5251 3 *
yihui 5:9b240c1d5251 4 * Licensed under the Apache License, Version 2.0 (the "License");
yihui 5:9b240c1d5251 5 * you may not use this file except in compliance with the License.
yihui 5:9b240c1d5251 6 * You may obtain a copy of the License at
yihui 5:9b240c1d5251 7 *
yihui 5:9b240c1d5251 8 * http://www.apache.org/licenses/LICENSE-2.0
yihui 5:9b240c1d5251 9 *
yihui 5:9b240c1d5251 10 * Unless required by applicable law or agreed to in writing, software
yihui 5:9b240c1d5251 11 * distributed under the License is distributed on an "AS IS" BASIS,
yihui 5:9b240c1d5251 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
yihui 5:9b240c1d5251 13 * See the License for the specific language governing permissions and
yihui 5:9b240c1d5251 14 * limitations under the License.
yihui 5:9b240c1d5251 15 */
yihui 5:9b240c1d5251 16 #ifndef MBED_DIRHANDLE_H
yihui 5:9b240c1d5251 17 #define MBED_DIRHANDLE_H
yihui 5:9b240c1d5251 18
yihui 5:9b240c1d5251 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
yihui 5:9b240c1d5251 20 # define NAME_MAX 255
yihui 5:9b240c1d5251 21 typedef int mode_t;
yihui 5:9b240c1d5251 22
yihui 5:9b240c1d5251 23 #else
yihui 5:9b240c1d5251 24 # include <sys/syslimits.h>
yihui 5:9b240c1d5251 25 #endif
yihui 5:9b240c1d5251 26
yihui 5:9b240c1d5251 27 #include "FileHandle.h"
yihui 5:9b240c1d5251 28
yihui 5:9b240c1d5251 29 struct dirent {
yihui 5:9b240c1d5251 30 char d_name[NAME_MAX+1];
yihui 5:9b240c1d5251 31 };
yihui 5:9b240c1d5251 32
yihui 5:9b240c1d5251 33 namespace mbed {
yihui 5:9b240c1d5251 34
yihui 5:9b240c1d5251 35 /** Represents a directory stream. Objects of this type are returned
yihui 5:9b240c1d5251 36 * by a FileSystemLike's opendir method. Implementations must define
yihui 5:9b240c1d5251 37 * at least closedir, readdir and rewinddir.
yihui 5:9b240c1d5251 38 *
yihui 5:9b240c1d5251 39 * If a FileSystemLike class defines the opendir method, then the
yihui 5:9b240c1d5251 40 * directories of an object of that type can be accessed by
yihui 5:9b240c1d5251 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
yihui 5:9b240c1d5251 42 * to open the root of the filesystem), and then using readdir(d) etc.
yihui 5:9b240c1d5251 43 *
yihui 5:9b240c1d5251 44 * The root directory is considered to contain all FileLike and
yihui 5:9b240c1d5251 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
yihui 5:9b240c1d5251 46 * reflect this.
yihui 5:9b240c1d5251 47 */
yihui 5:9b240c1d5251 48 class DirHandle {
yihui 5:9b240c1d5251 49
yihui 5:9b240c1d5251 50 public:
yihui 5:9b240c1d5251 51 /** Closes the directory.
yihui 5:9b240c1d5251 52 *
yihui 5:9b240c1d5251 53 * @returns
yihui 5:9b240c1d5251 54 * 0 on success,
yihui 5:9b240c1d5251 55 * -1 on error.
yihui 5:9b240c1d5251 56 */
yihui 5:9b240c1d5251 57 virtual int closedir()=0;
yihui 5:9b240c1d5251 58
yihui 5:9b240c1d5251 59 /** Return the directory entry at the current position, and
yihui 5:9b240c1d5251 60 * advances the position to the next entry.
yihui 5:9b240c1d5251 61 *
yihui 5:9b240c1d5251 62 * @returns
yihui 5:9b240c1d5251 63 * A pointer to a dirent structure representing the
yihui 5:9b240c1d5251 64 * directory entry at the current position, or NULL on reaching
yihui 5:9b240c1d5251 65 * end of directory or error.
yihui 5:9b240c1d5251 66 */
yihui 5:9b240c1d5251 67 virtual struct dirent *readdir()=0;
yihui 5:9b240c1d5251 68
yihui 5:9b240c1d5251 69 /** Resets the position to the beginning of the directory.
yihui 5:9b240c1d5251 70 */
yihui 5:9b240c1d5251 71 virtual void rewinddir()=0;
yihui 5:9b240c1d5251 72
yihui 5:9b240c1d5251 73 /** Returns the current position of the DirHandle.
yihui 5:9b240c1d5251 74 *
yihui 5:9b240c1d5251 75 * @returns
yihui 5:9b240c1d5251 76 * the current position,
yihui 5:9b240c1d5251 77 * -1 on error.
yihui 5:9b240c1d5251 78 */
yihui 5:9b240c1d5251 79 virtual off_t telldir() { return -1; }
yihui 5:9b240c1d5251 80
yihui 5:9b240c1d5251 81 /** Sets the position of the DirHandle.
yihui 5:9b240c1d5251 82 *
yihui 5:9b240c1d5251 83 * @param location The location to seek to. Must be a value returned by telldir.
yihui 5:9b240c1d5251 84 */
yihui 5:9b240c1d5251 85 virtual void seekdir(off_t location) { }
yihui 5:9b240c1d5251 86
yihui 5:9b240c1d5251 87 virtual ~DirHandle() {}
yihui 5:9b240c1d5251 88 };
yihui 5:9b240c1d5251 89
yihui 5:9b240c1d5251 90 } // namespace mbed
yihui 5:9b240c1d5251 91
yihui 5:9b240c1d5251 92 typedef mbed::DirHandle DIR;
yihui 5:9b240c1d5251 93
yihui 5:9b240c1d5251 94 extern "C" {
yihui 5:9b240c1d5251 95 DIR *opendir(const char*);
yihui 5:9b240c1d5251 96 struct dirent *readdir(DIR *);
yihui 5:9b240c1d5251 97 int closedir(DIR*);
yihui 5:9b240c1d5251 98 void rewinddir(DIR*);
yihui 5:9b240c1d5251 99 long telldir(DIR*);
yihui 5:9b240c1d5251 100 void seekdir(DIR*, long);
yihui 5:9b240c1d5251 101 int mkdir(const char *name, mode_t n);
yihui 5:9b240c1d5251 102 };
yihui 5:9b240c1d5251 103
yihui 5:9b240c1d5251 104 #endif /* MBED_DIRHANDLE_H */