fixed drive strength

Dependents:   capstone_i2c

Fork of mbed-dev by mbed official

Committer:
<>
Date:
Fri Oct 28 11:17:30 2016 +0100
Revision:
149:156823d33999
Child:
160:d5399cc887bb
This updates the lib to the mbed lib v128

NOTE: This release includes a restructuring of the file and directory locations and thus some
include paths in your code may need updating accordingly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /* mbed Microcontroller Library
<> 149:156823d33999 2 * Copyright (c) 2006-2013 ARM Limited
<> 149:156823d33999 3 *
<> 149:156823d33999 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 149:156823d33999 5 * you may not use this file except in compliance with the License.
<> 149:156823d33999 6 * You may obtain a copy of the License at
<> 149:156823d33999 7 *
<> 149:156823d33999 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 149:156823d33999 9 *
<> 149:156823d33999 10 * Unless required by applicable law or agreed to in writing, software
<> 149:156823d33999 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 149:156823d33999 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 149:156823d33999 13 * See the License for the specific language governing permissions and
<> 149:156823d33999 14 * limitations under the License.
<> 149:156823d33999 15 */
<> 149:156823d33999 16 #include <stdio.h>
<> 149:156823d33999 17 #include "hal/gpio_api.h"
<> 149:156823d33999 18 #include "platform/wait_api.h"
<> 149:156823d33999 19 #include "platform/toolchain.h"
<> 149:156823d33999 20 #include "platform/mbed_interface.h"
<> 149:156823d33999 21 #include "platform/critical.h"
<> 149:156823d33999 22 #include "hal/serial_api.h"
<> 149:156823d33999 23
<> 149:156823d33999 24 #if DEVICE_SERIAL
<> 149:156823d33999 25 extern int stdio_uart_inited;
<> 149:156823d33999 26 extern serial_t stdio_uart;
<> 149:156823d33999 27 #endif
<> 149:156823d33999 28
<> 149:156823d33999 29 WEAK void mbed_die(void) {
<> 149:156823d33999 30 #if !defined (NRF51_H) && !defined(TARGET_EFM32)
<> 149:156823d33999 31 core_util_critical_section_enter();
<> 149:156823d33999 32 #endif
<> 149:156823d33999 33 #if (DEVICE_ERROR_RED == 1)
<> 149:156823d33999 34 gpio_t led_red; gpio_init_out(&led_red, LED_RED);
<> 149:156823d33999 35 #elif (DEVICE_ERROR_PATTERN == 1)
<> 149:156823d33999 36 gpio_t led_1; gpio_init_out(&led_1, LED1);
<> 149:156823d33999 37 gpio_t led_2; gpio_init_out(&led_2, LED2);
<> 149:156823d33999 38 gpio_t led_3; gpio_init_out(&led_3, LED3);
<> 149:156823d33999 39 gpio_t led_4; gpio_init_out(&led_4, LED4);
<> 149:156823d33999 40 #endif
<> 149:156823d33999 41
<> 149:156823d33999 42 while (1) {
<> 149:156823d33999 43 #if (DEVICE_ERROR_RED == 1)
<> 149:156823d33999 44 gpio_write(&led_red, 1);
<> 149:156823d33999 45
<> 149:156823d33999 46 #elif (DEVICE_ERROR_PATTERN == 1)
<> 149:156823d33999 47 gpio_write(&led_1, 1);
<> 149:156823d33999 48 gpio_write(&led_2, 0);
<> 149:156823d33999 49 gpio_write(&led_3, 0);
<> 149:156823d33999 50 gpio_write(&led_4, 1);
<> 149:156823d33999 51 #endif
<> 149:156823d33999 52
<> 149:156823d33999 53 wait_ms(150);
<> 149:156823d33999 54
<> 149:156823d33999 55 #if (DEVICE_ERROR_RED == 1)
<> 149:156823d33999 56 gpio_write(&led_red, 0);
<> 149:156823d33999 57
<> 149:156823d33999 58 #elif (DEVICE_ERROR_PATTERN == 1)
<> 149:156823d33999 59 gpio_write(&led_1, 0);
<> 149:156823d33999 60 gpio_write(&led_2, 1);
<> 149:156823d33999 61 gpio_write(&led_3, 1);
<> 149:156823d33999 62 gpio_write(&led_4, 0);
<> 149:156823d33999 63 #endif
<> 149:156823d33999 64
<> 149:156823d33999 65 wait_ms(150);
<> 149:156823d33999 66 }
<> 149:156823d33999 67 }
<> 149:156823d33999 68
<> 149:156823d33999 69 void mbed_error_printf(const char* format, ...) {
<> 149:156823d33999 70 va_list arg;
<> 149:156823d33999 71 va_start(arg, format);
<> 149:156823d33999 72 mbed_error_vfprintf(format, arg);
<> 149:156823d33999 73 va_end(arg);
<> 149:156823d33999 74 }
<> 149:156823d33999 75
<> 149:156823d33999 76 void mbed_error_vfprintf(const char * format, va_list arg) {
<> 149:156823d33999 77 #if DEVICE_SERIAL
<> 149:156823d33999 78 core_util_critical_section_enter();
<> 149:156823d33999 79 char buffer[128];
<> 149:156823d33999 80 int size = vsprintf(buffer, format, arg);
<> 149:156823d33999 81 if (size > 0) {
<> 149:156823d33999 82 if (!stdio_uart_inited) {
<> 149:156823d33999 83 serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX);
<> 149:156823d33999 84 }
<> 149:156823d33999 85 for (int i = 0; i < size; i++) {
<> 149:156823d33999 86 serial_putc(&stdio_uart, buffer[i]);
<> 149:156823d33999 87 }
<> 149:156823d33999 88 }
<> 149:156823d33999 89 core_util_critical_section_exit();
<> 149:156823d33999 90 #endif
<> 149:156823d33999 91 }