[EFM32] Small fixes

* Use mbed_error
* Include cmsis headers by default when grabbing device.h
* Get rid of enum to uint casting in pinmap
pull/3122/head
Steven Cooreman 2016-10-22 19:03:18 +02:00
parent 4df6986100
commit 1f3003fb22
9 changed files with 6 additions and 83 deletions

View File

@ -25,7 +25,7 @@
#if DEVICE_ANALOGOUT
#include "mbed_assert.h"
#include "error.h"
#include "mbed_error.h"
#include "analogout_api.h"
#include "pinmap.h"
#include "pinmap_function.h"

View File

@ -23,6 +23,7 @@
#ifndef MBED_DEVICE_H
#define MBED_DEVICE_H
#include "cmsis.h"
#include "objects.h"
#include "device_peripherals.h"

View File

@ -1,74 +0,0 @@
/***************************************************************************//**
* @file error.h
*******************************************************************************
* @section License
* <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
#ifndef MBED_ERROR_H
#define MBED_ERROR_H
/** To generate a fatal compile-time error, you can use the pre-processor #error directive.
*
* @code
* #error "That shouldn't have happened!"
* @endcode
*
* If the compiler evaluates this line, it will report the error and stop the compile.
*
* For example, you could use this to check some user-defined compile-time variables:
*
* @code
* #define NUM_PORTS 7
* #if (NUM_PORTS > 4)
* #error "NUM_PORTS must be less than 4"
* #endif
* @endcode
*
* Reporting Run-Time Errors:
* To generate a fatal run-time error, you can use the mbed error() function.
*
* @code
* error("That shouldn't have happened!");
* @endcode
*
* If the mbed running the program executes this function, it will print the
* message via the USB serial port, and then die with the blue lights of death!
*
* The message can use printf-style formatting, so you can report variables in the
* message too. For example, you could use this to check a run-time condition:
*
* @code
* if(x >= 5) {
* error("expected x to be less than 5, but got %d", x);
* }
* #endcode
*/
#ifdef __cplusplus
extern "C" {
#endif
void error(const char* format, ...);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -35,7 +35,7 @@ void pin_function(PinName pin, int function)
void pin_mode(PinName pin, PinMode mode)
{
MBED_ASSERT((0xFFFFFF00 |pin) != NC);
MBED_ASSERT(pin != NC);
/* Enable GPIO clock if not already done */
if (!gpio_clock_inited) {

View File

@ -23,7 +23,7 @@
#include "pinmap_function.h"
#include "PinNames.h"
#include "error.h"
#include "mbed_error.h"
/**
* Get the value of the function field for a pin in a pinmap

View File

@ -27,7 +27,6 @@
#include "mbed_assert.h"
#include "pwmout_api.h"
#include "cmsis.h"
#include "pinmap.h"
#include "PeripheralPins.h"
#include "device_peripherals.h"

View File

@ -26,7 +26,6 @@
#include "sleep_api.h"
#include "sleepmodes.h"
#include "cmsis.h"
#include "em_emu.h"
#include "critical.h"

View File

@ -29,7 +29,7 @@
#include "PeripheralPins.h"
#include "pinmap.h"
#include "pinmap_function.h"
#include "error.h"
#include "mbed_error.h"
#include "dma_api.h"
#include "dma_api_HAL.h"

View File

@ -23,12 +23,10 @@
#include <stddef.h>
#include "us_ticker_api.h"
#include "cmsis.h"
#include "device.h"
#include "mbed_assert.h"
#include "em_cmu.h"
#include "em_timer.h"
#include "device_peripherals.h"
#include "device.h"
#include "clocking.h"
#include "sleep_api.h"
#include "sleepmodes.h"