mbed lib with startup delay fixed for Nucleo401RE

Fork of mbed-src by mbed official

Committer:
emilmont
Date:
Wed Mar 13 15:04:05 2013 +0000
Revision:
4:c4bfb462ca53
Add default LED patterns for error notification; Add module for common logic for sorted linked list of events; Move the PinName parsing to the RPC library;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 4:c4bfb462ca53 1 /* mbed Microcontroller Library
emilmont 4:c4bfb462ca53 2 * Copyright (c) 2006-2013 ARM Limited
emilmont 4:c4bfb462ca53 3 *
emilmont 4:c4bfb462ca53 4 * Licensed under the Apache License, Version 2.0 (the "License");
emilmont 4:c4bfb462ca53 5 * you may not use this file except in compliance with the License.
emilmont 4:c4bfb462ca53 6 * You may obtain a copy of the License at
emilmont 4:c4bfb462ca53 7 *
emilmont 4:c4bfb462ca53 8 * http://www.apache.org/licenses/LICENSE-2.0
emilmont 4:c4bfb462ca53 9 *
emilmont 4:c4bfb462ca53 10 * Unless required by applicable law or agreed to in writing, software
emilmont 4:c4bfb462ca53 11 * distributed under the License is distributed on an "AS IS" BASIS,
emilmont 4:c4bfb462ca53 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
emilmont 4:c4bfb462ca53 13 * See the License for the specific language governing permissions and
emilmont 4:c4bfb462ca53 14 * limitations under the License.
emilmont 4:c4bfb462ca53 15 */
emilmont 4:c4bfb462ca53 16 #include "gpio_api.h"
emilmont 4:c4bfb462ca53 17 #include "wait_api.h"
emilmont 4:c4bfb462ca53 18 #include "toolchain.h"
emilmont 4:c4bfb462ca53 19
emilmont 4:c4bfb462ca53 20 WEAK void mbed_die(void);
emilmont 4:c4bfb462ca53 21 WEAK void mbed_die(void) {
emilmont 4:c4bfb462ca53 22 #if defined(DEVICE_ERROR_RED)
emilmont 4:c4bfb462ca53 23 gpio_t led_red; gpio_init(&led_red, LED_RED, PIN_OUTPUT);
emilmont 4:c4bfb462ca53 24
emilmont 4:c4bfb462ca53 25 #elif defined(DEVICE_ERROR_PATTERN)
emilmont 4:c4bfb462ca53 26 gpio_t led_1; gpio_init(&led_1, LED1, PIN_OUTPUT);
emilmont 4:c4bfb462ca53 27 gpio_t led_2; gpio_init(&led_2, LED2, PIN_OUTPUT);
emilmont 4:c4bfb462ca53 28 gpio_t led_3; gpio_init(&led_3, LED3, PIN_OUTPUT);
emilmont 4:c4bfb462ca53 29 gpio_t led_4; gpio_init(&led_4, LED4, PIN_OUTPUT);
emilmont 4:c4bfb462ca53 30 #endif
emilmont 4:c4bfb462ca53 31
emilmont 4:c4bfb462ca53 32 while (1) {
emilmont 4:c4bfb462ca53 33 #if defined(DEVICE_ERROR_RED)
emilmont 4:c4bfb462ca53 34 gpio_write(&led_red, 1);
emilmont 4:c4bfb462ca53 35
emilmont 4:c4bfb462ca53 36 #elif defined(DEVICE_ERROR_PATTERN)
emilmont 4:c4bfb462ca53 37 gpio_write(&led_1, 1);
emilmont 4:c4bfb462ca53 38 gpio_write(&led_2, 0);
emilmont 4:c4bfb462ca53 39 gpio_write(&led_3, 0);
emilmont 4:c4bfb462ca53 40 gpio_write(&led_4, 1);
emilmont 4:c4bfb462ca53 41 #endif
emilmont 4:c4bfb462ca53 42 wait_ms(150);
emilmont 4:c4bfb462ca53 43
emilmont 4:c4bfb462ca53 44 #if defined(DEVICE_ERROR_RED)
emilmont 4:c4bfb462ca53 45 gpio_write(&led_red, 0);
emilmont 4:c4bfb462ca53 46
emilmont 4:c4bfb462ca53 47 #elif defined(DEVICE_ERROR_PATTERN)
emilmont 4:c4bfb462ca53 48 gpio_write(&led_1, 0);
emilmont 4:c4bfb462ca53 49 gpio_write(&led_2, 1);
emilmont 4:c4bfb462ca53 50 gpio_write(&led_3, 1);
emilmont 4:c4bfb462ca53 51 gpio_write(&led_4, 0);
emilmont 4:c4bfb462ca53 52 #endif
emilmont 4:c4bfb462ca53 53 wait_ms(150);
emilmont 4:c4bfb462ca53 54 }
emilmont 4:c4bfb462ca53 55 }