mbed library for NZ32-SC151
common/board.c@17:639ed60ce759, 2016-08-19 (annotated)
- Committer:
- modtronix-com
- Date:
- Fri Aug 19 15:46:42 2016 +1000
- Revision:
- 17:639ed60ce759
- Parent:
- 1:71204b8406f2
Added tag v1.1 for changeset 076cbe3e55be
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
modtronix | 1:71204b8406f2 | 1 | /* mbed Microcontroller Library |
modtronix | 1:71204b8406f2 | 2 | * Copyright (c) 2006-2013 ARM Limited |
modtronix | 1:71204b8406f2 | 3 | * |
modtronix | 1:71204b8406f2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
modtronix | 1:71204b8406f2 | 5 | * you may not use this file except in compliance with the License. |
modtronix | 1:71204b8406f2 | 6 | * You may obtain a copy of the License at |
modtronix | 1:71204b8406f2 | 7 | * |
modtronix | 1:71204b8406f2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
modtronix | 1:71204b8406f2 | 9 | * |
modtronix | 1:71204b8406f2 | 10 | * Unless required by applicable law or agreed to in writing, software |
modtronix | 1:71204b8406f2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
modtronix | 1:71204b8406f2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
modtronix | 1:71204b8406f2 | 13 | * See the License for the specific language governing permissions and |
modtronix | 1:71204b8406f2 | 14 | * limitations under the License. |
modtronix | 1:71204b8406f2 | 15 | */ |
modtronix | 1:71204b8406f2 | 16 | #include "gpio_api.h" |
modtronix | 1:71204b8406f2 | 17 | #include "wait_api.h" |
modtronix | 1:71204b8406f2 | 18 | #include "toolchain.h" |
modtronix | 1:71204b8406f2 | 19 | #include "mbed_interface.h" |
modtronix | 1:71204b8406f2 | 20 | |
modtronix | 1:71204b8406f2 | 21 | WEAK void mbed_die(void) { |
modtronix | 1:71204b8406f2 | 22 | #ifndef NRF51_H |
modtronix | 1:71204b8406f2 | 23 | __disable_irq(); // dont allow interrupts to disturb the flash pattern |
modtronix | 1:71204b8406f2 | 24 | #endif |
modtronix | 1:71204b8406f2 | 25 | #if (DEVICE_ERROR_RED == 1) |
modtronix | 1:71204b8406f2 | 26 | gpio_t led_red; gpio_init_out(&led_red, LED_RED); |
modtronix | 1:71204b8406f2 | 27 | #elif (DEVICE_ERROR_PATTERN == 1) |
modtronix | 1:71204b8406f2 | 28 | gpio_t led_1; gpio_init_out(&led_1, LED1); |
modtronix | 1:71204b8406f2 | 29 | gpio_t led_2; gpio_init_out(&led_2, LED2); |
modtronix | 1:71204b8406f2 | 30 | gpio_t led_3; gpio_init_out(&led_3, LED3); |
modtronix | 1:71204b8406f2 | 31 | gpio_t led_4; gpio_init_out(&led_4, LED4); |
modtronix | 1:71204b8406f2 | 32 | #endif |
modtronix | 1:71204b8406f2 | 33 | |
modtronix | 1:71204b8406f2 | 34 | while (1) { |
modtronix | 1:71204b8406f2 | 35 | #if (DEVICE_ERROR_RED == 1) |
modtronix | 1:71204b8406f2 | 36 | gpio_write(&led_red, 1); |
modtronix | 1:71204b8406f2 | 37 | |
modtronix | 1:71204b8406f2 | 38 | #elif (DEVICE_ERROR_PATTERN == 1) |
modtronix | 1:71204b8406f2 | 39 | gpio_write(&led_1, 1); |
modtronix | 1:71204b8406f2 | 40 | gpio_write(&led_2, 0); |
modtronix | 1:71204b8406f2 | 41 | gpio_write(&led_3, 0); |
modtronix | 1:71204b8406f2 | 42 | gpio_write(&led_4, 1); |
modtronix | 1:71204b8406f2 | 43 | #endif |
modtronix | 1:71204b8406f2 | 44 | |
modtronix | 1:71204b8406f2 | 45 | wait_ms(150); |
modtronix | 1:71204b8406f2 | 46 | |
modtronix | 1:71204b8406f2 | 47 | #if (DEVICE_ERROR_RED == 1) |
modtronix | 1:71204b8406f2 | 48 | gpio_write(&led_red, 0); |
modtronix | 1:71204b8406f2 | 49 | |
modtronix | 1:71204b8406f2 | 50 | #elif (DEVICE_ERROR_PATTERN == 1) |
modtronix | 1:71204b8406f2 | 51 | gpio_write(&led_1, 0); |
modtronix | 1:71204b8406f2 | 52 | gpio_write(&led_2, 1); |
modtronix | 1:71204b8406f2 | 53 | gpio_write(&led_3, 1); |
modtronix | 1:71204b8406f2 | 54 | gpio_write(&led_4, 0); |
modtronix | 1:71204b8406f2 | 55 | #endif |
modtronix | 1:71204b8406f2 | 56 | |
modtronix | 1:71204b8406f2 | 57 | wait_ms(150); |
modtronix | 1:71204b8406f2 | 58 | } |
modtronix | 1:71204b8406f2 | 59 | } |