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 #include "gpio_api.h"
yihui 5:9b240c1d5251 17 #include "wait_api.h"
yihui 5:9b240c1d5251 18 #include "toolchain.h"
yihui 5:9b240c1d5251 19 #include "mbed_interface.h"
yihui 5:9b240c1d5251 20
yihui 5:9b240c1d5251 21 WEAK void mbed_die(void) {
yihui 5:9b240c1d5251 22 #if !defined (NRF51_H) && !defined(TARGET_EFM32)
yihui 5:9b240c1d5251 23 __disable_irq(); // dont allow interrupts to disturb the flash pattern
yihui 5:9b240c1d5251 24 #endif
yihui 5:9b240c1d5251 25 #if (DEVICE_ERROR_RED == 1)
yihui 5:9b240c1d5251 26 gpio_t led_red; gpio_init_out(&led_red, LED_RED);
yihui 5:9b240c1d5251 27 #elif (DEVICE_ERROR_PATTERN == 1)
yihui 5:9b240c1d5251 28 gpio_t led_1; gpio_init_out(&led_1, LED1);
yihui 5:9b240c1d5251 29 gpio_t led_2; gpio_init_out(&led_2, LED2);
yihui 5:9b240c1d5251 30 gpio_t led_3; gpio_init_out(&led_3, LED3);
yihui 5:9b240c1d5251 31 gpio_t led_4; gpio_init_out(&led_4, LED4);
yihui 5:9b240c1d5251 32 #endif
yihui 5:9b240c1d5251 33
yihui 5:9b240c1d5251 34 while (1) {
yihui 5:9b240c1d5251 35 #if (DEVICE_ERROR_RED == 1)
yihui 5:9b240c1d5251 36 gpio_write(&led_red, 1);
yihui 5:9b240c1d5251 37
yihui 5:9b240c1d5251 38 #elif (DEVICE_ERROR_PATTERN == 1)
yihui 5:9b240c1d5251 39 gpio_write(&led_1, 1);
yihui 5:9b240c1d5251 40 gpio_write(&led_2, 0);
yihui 5:9b240c1d5251 41 gpio_write(&led_3, 0);
yihui 5:9b240c1d5251 42 gpio_write(&led_4, 1);
yihui 5:9b240c1d5251 43 #endif
yihui 5:9b240c1d5251 44
yihui 5:9b240c1d5251 45 wait_ms(150);
yihui 5:9b240c1d5251 46
yihui 5:9b240c1d5251 47 #if (DEVICE_ERROR_RED == 1)
yihui 5:9b240c1d5251 48 gpio_write(&led_red, 0);
yihui 5:9b240c1d5251 49
yihui 5:9b240c1d5251 50 #elif (DEVICE_ERROR_PATTERN == 1)
yihui 5:9b240c1d5251 51 gpio_write(&led_1, 0);
yihui 5:9b240c1d5251 52 gpio_write(&led_2, 1);
yihui 5:9b240c1d5251 53 gpio_write(&led_3, 1);
yihui 5:9b240c1d5251 54 gpio_write(&led_4, 0);
yihui 5:9b240c1d5251 55 #endif
yihui 5:9b240c1d5251 56
yihui 5:9b240c1d5251 57 wait_ms(150);
yihui 5:9b240c1d5251 58 }
yihui 5:9b240c1d5251 59 }