mbed library sources

Fork of mbed-src by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers board.c Source File

board.c

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "gpio_api.h"
00017 #include "wait_api.h"
00018 #include "toolchain.h"
00019 #include "mbed_interface.h"
00020 
00021 WEAK void mbed_die(void) {
00022 #if !defined (NRF51_H) && !defined(TARGET_EFM32)
00023     __disable_irq();    // dont allow interrupts to disturb the flash pattern
00024 #endif
00025 #if   (DEVICE_ERROR_RED == 1)
00026     gpio_t led_red; gpio_init_out(&led_red, LED_RED);
00027 #elif (DEVICE_ERROR_PATTERN == 1)
00028     gpio_t led_1; gpio_init_out(&led_1, LED1);
00029     gpio_t led_2; gpio_init_out(&led_2, LED2);
00030     gpio_t led_3; gpio_init_out(&led_3, LED3);
00031     gpio_t led_4; gpio_init_out(&led_4, LED4);
00032 #endif
00033 
00034     while (1) {
00035 #if   (DEVICE_ERROR_RED == 1)
00036         gpio_write(&led_red, 1);
00037 
00038 #elif (DEVICE_ERROR_PATTERN == 1)
00039         gpio_write(&led_1, 1);
00040         gpio_write(&led_2, 0);
00041         gpio_write(&led_3, 0);
00042         gpio_write(&led_4, 1);
00043 #endif
00044 
00045         wait_ms(150);
00046 
00047 #if   (DEVICE_ERROR_RED == 1)
00048         gpio_write(&led_red, 0);
00049 
00050 #elif (DEVICE_ERROR_PATTERN == 1)
00051         gpio_write(&led_1, 0);
00052         gpio_write(&led_2, 1);
00053         gpio_write(&led_3, 1);
00054         gpio_write(&led_4, 0);
00055 #endif
00056 
00057         wait_ms(150);
00058     }
00059 }