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_SEMIHOST_H
yihui 5:9b240c1d5251 17 #define MBED_SEMIHOST_H
yihui 5:9b240c1d5251 18
yihui 5:9b240c1d5251 19 #include "device.h"
yihui 5:9b240c1d5251 20 #include "toolchain.h"
yihui 5:9b240c1d5251 21
yihui 5:9b240c1d5251 22 #ifdef __cplusplus
yihui 5:9b240c1d5251 23 extern "C" {
yihui 5:9b240c1d5251 24 #endif
yihui 5:9b240c1d5251 25
yihui 5:9b240c1d5251 26 #if DEVICE_SEMIHOST
yihui 5:9b240c1d5251 27
yihui 5:9b240c1d5251 28 #ifndef __CC_ARM
yihui 5:9b240c1d5251 29
yihui 5:9b240c1d5251 30 #if defined(__ICCARM__)
yihui 5:9b240c1d5251 31 inline int __semihost(int reason, const void *arg) {
yihui 5:9b240c1d5251 32 return __semihosting(reason, (void*)arg);
yihui 5:9b240c1d5251 33 }
yihui 5:9b240c1d5251 34 #else
yihui 5:9b240c1d5251 35
yihui 5:9b240c1d5251 36 #ifdef __thumb__
yihui 5:9b240c1d5251 37 # define AngelSWI 0xAB
yihui 5:9b240c1d5251 38 # define AngelSWIInsn "bkpt"
yihui 5:9b240c1d5251 39 # define AngelSWIAsm bkpt
yihui 5:9b240c1d5251 40 #else
yihui 5:9b240c1d5251 41 # define AngelSWI 0x123456
yihui 5:9b240c1d5251 42 # define AngelSWIInsn "swi"
yihui 5:9b240c1d5251 43 # define AngelSWIAsm swi
yihui 5:9b240c1d5251 44 #endif
yihui 5:9b240c1d5251 45
yihui 5:9b240c1d5251 46 static inline int __semihost(int reason, const void *arg) {
yihui 5:9b240c1d5251 47 int value;
yihui 5:9b240c1d5251 48
yihui 5:9b240c1d5251 49 asm volatile (
yihui 5:9b240c1d5251 50 "mov r0, %1" "\n\t"
yihui 5:9b240c1d5251 51 "mov r1, %2" "\n\t"
yihui 5:9b240c1d5251 52 AngelSWIInsn " %a3" "\n\t"
yihui 5:9b240c1d5251 53 "mov %0, r0"
yihui 5:9b240c1d5251 54 : "=r" (value) /* output operands */
yihui 5:9b240c1d5251 55 : "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */
yihui 5:9b240c1d5251 56 : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */
yihui 5:9b240c1d5251 57 );
yihui 5:9b240c1d5251 58
yihui 5:9b240c1d5251 59 return value;
yihui 5:9b240c1d5251 60 }
yihui 5:9b240c1d5251 61 #endif
yihui 5:9b240c1d5251 62 #endif
yihui 5:9b240c1d5251 63
yihui 5:9b240c1d5251 64 #if DEVICE_LOCALFILESYSTEM
yihui 5:9b240c1d5251 65 FILEHANDLE semihost_open(const char* name, int openmode);
yihui 5:9b240c1d5251 66 int semihost_close (FILEHANDLE fh);
yihui 5:9b240c1d5251 67 int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
yihui 5:9b240c1d5251 68 int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
yihui 5:9b240c1d5251 69 int semihost_ensure(FILEHANDLE fh);
yihui 5:9b240c1d5251 70 long semihost_flen (FILEHANDLE fh);
yihui 5:9b240c1d5251 71 int semihost_seek (FILEHANDLE fh, long position);
yihui 5:9b240c1d5251 72 int semihost_istty (FILEHANDLE fh);
yihui 5:9b240c1d5251 73
yihui 5:9b240c1d5251 74 int semihost_remove(const char *name);
yihui 5:9b240c1d5251 75 int semihost_rename(const char *old_name, const char *new_name);
yihui 5:9b240c1d5251 76 #endif
yihui 5:9b240c1d5251 77
yihui 5:9b240c1d5251 78 int semihost_uid(char *uid);
yihui 5:9b240c1d5251 79 int semihost_reset(void);
yihui 5:9b240c1d5251 80 int semihost_vbus(void);
yihui 5:9b240c1d5251 81 int semihost_powerdown(void);
yihui 5:9b240c1d5251 82 int semihost_exit(void);
yihui 5:9b240c1d5251 83
yihui 5:9b240c1d5251 84 int semihost_connected(void);
yihui 5:9b240c1d5251 85 int semihost_disabledebug(void);
yihui 5:9b240c1d5251 86
yihui 5:9b240c1d5251 87 #endif
yihui 5:9b240c1d5251 88
yihui 5:9b240c1d5251 89 #ifdef __cplusplus
yihui 5:9b240c1d5251 90 }
yihui 5:9b240c1d5251 91 #endif
yihui 5:9b240c1d5251 92
yihui 5:9b240c1d5251 93 #endif