]> git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/common/board.c
Merge commit '1fe4406f374291ab2e86e95a97341fd9c475fcb8'
[tmk_keyboard.git] / tmk_core / tool / mbed / mbed-sdk / libraries / mbed / common / board.c
1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "gpio_api.h"
17 #include "wait_api.h"
18 #include "toolchain.h"
19 #include "mbed_interface.h"
20
21 WEAK void mbed_die(void) {
22 #ifndef NRF51_H
23 __disable_irq(); // dont allow interrupts to disturb the flash pattern
24 #endif
25 #if (DEVICE_ERROR_RED == 1)
26 gpio_t led_red; gpio_init_out(&led_red, LED_RED);
27 #elif (DEVICE_ERROR_PATTERN == 1)
28 gpio_t led_1; gpio_init_out(&led_1, LED1);
29 gpio_t led_2; gpio_init_out(&led_2, LED2);
30 gpio_t led_3; gpio_init_out(&led_3, LED3);
31 gpio_t led_4; gpio_init_out(&led_4, LED4);
32 #endif
33
34 while (1) {
35 #if (DEVICE_ERROR_RED == 1)
36 gpio_write(&led_red, 1);
37
38 #elif (DEVICE_ERROR_PATTERN == 1)
39 gpio_write(&led_1, 1);
40 gpio_write(&led_2, 0);
41 gpio_write(&led_3, 0);
42 gpio_write(&led_4, 1);
43 #endif
44
45 wait_ms(150);
46
47 #if (DEVICE_ERROR_RED == 1)
48 gpio_write(&led_red, 0);
49
50 #elif (DEVICE_ERROR_PATTERN == 1)
51 gpio_write(&led_1, 0);
52 gpio_write(&led_2, 1);
53 gpio_write(&led_3, 1);
54 gpio_write(&led_4, 0);
55 #endif
56
57 wait_ms(150);
58 }
59 }
Imprint / Impressum