mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/spi_api.c
- Revision:
- 227:7bd0639b8911
- Parent:
- 82:0b31dbcd4769
--- a/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/spi_api.c Wed Jun 11 09:45:09 2014 +0100 +++ b/targets/hal/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/spi_api.c Wed Jun 11 16:00:09 2014 +0100 @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include "mbed_assert.h" #include "spi_api.h" #include <math.h> #include "cmsis.h" #include "pinmap.h" -#include "error.h" static const PinMap PinMap_SPI_SCLK[] = { {PTA15, SPI_0, 2}, @@ -90,9 +90,7 @@ SPIName spi_cntl = (SPIName)pinmap_merge(spi_sclk, spi_ssel); obj->spi = (SPI_Type*)pinmap_merge(spi_data, spi_cntl); - if ((int)obj->spi == NC) { - error("SPI pinout mapping failed"); - } + MBED_ASSERT((int)obj->spi != NC); // enable power and clocking switch ((int)obj->spi) { @@ -125,13 +123,8 @@ // [TODO] } void spi_format(spi_t *obj, int bits, int mode, int slave) { - if ((bits != 8) && (bits != 16)) { - error("Only 8/16 bits SPI supported"); - } - - if ((mode < 0) || (mode > 3)) { - error("SPI mode unsupported"); - } + MBED_ASSERT((bits == 8) || (bits == 16)); + MBED_ASSERT((mode >= 0) && (mode <= 3)); uint8_t polarity = (mode & 0x2) ? 1 : 0; uint8_t phase = (mode & 0x1) ? 1 : 0;