Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers static_pinmap.cpp Source File

static_pinmap.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #include "mbed_error.h"
00019 #include "static_pinmap.h"
00020 
00021 
00022 /*
00023  * This file provides default definitions of xxx_direct() functions for peripherals.
00024  * in all cases standard init function is called, which won't give any ROM memory savings.
00025  *
00026  */
00027 
00028 #if DEVICE_SPI
00029 MBED_WEAK void spi_init_direct(spi_t *obj, const spi_pinmap_t *pinmap)
00030 {
00031     spi_init(obj, pinmap->mosi_pin, pinmap->miso_pin, pinmap->sclk_pin, pinmap->ssel_pin);
00032 }
00033 #endif
00034 
00035 #if DEVICE_PWMOUT
00036 MBED_WEAK void pwmout_init_direct(pwmout_t *obj, const PinMap *pinmap)
00037 {
00038     pwmout_init(obj, pinmap->pin);
00039 }
00040 #endif
00041 
00042 #if DEVICE_ANALOGIN
00043 MBED_WEAK void analogin_init_direct(analogin_t *obj, const PinMap *pinmap)
00044 {
00045     analogin_init(obj, pinmap->pin);
00046 }
00047 #endif
00048 
00049 #if DEVICE_ANALOGOUT
00050 MBED_WEAK void analogout_init_direct(dac_t *obj, const PinMap *pinmap)
00051 {
00052     analogout_init(obj, pinmap->pin);
00053 }
00054 #endif
00055 
00056 #if DEVICE_I2C
00057 MBED_WEAK void i2c_init_direct(i2c_t *obj, const i2c_pinmap_t *pinmap)
00058 {
00059     i2c_init(obj, pinmap->sda_pin, pinmap->scl_pin);
00060 }
00061 #endif
00062 
00063 #if DEVICE_SERIAL
00064 MBED_WEAK void serial_init_direct(serial_t *obj, const serial_pinmap_t *pinmap)
00065 {
00066     serial_init(obj, pinmap->tx_pin, pinmap->rx_pin);
00067 }
00068 
00069 #if DEVICE_SERIAL_FC
00070 MBED_WEAK void serial_set_flow_control_direct(serial_t *obj, FlowControl type, const serial_fc_pinmap_t *pinmap)
00071 {
00072     serial_set_flow_control(obj, type, pinmap->rx_flow_pin, pinmap->tx_flow_pin);
00073 }
00074 #endif
00075 
00076 #if DEVICE_CAN
00077 MBED_WEAK void can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz)
00078 {
00079     can_init_freq(obj, pinmap->rd_pin, pinmap->td_pin, hz);
00080 }
00081 
00082 MBED_WEAK void can_init_direct(can_t *obj, const can_pinmap_t *pinmap)
00083 {
00084     can_init(obj, pinmap->rd_pin, pinmap->td_pin);
00085 }
00086 
00087 #endif
00088 
00089 #if DEVICE_QSPI
00090 MBED_WEAK qspi_status_t qspi_init_direct(qspi_t *obj, const qspi_pinmap_t *pinmap, uint32_t hz, uint8_t mode)
00091 {
00092     return qspi_init(obj, pinmap->data0_pin, pinmap->data1_pin, pinmap->data2_pin, pinmap->data3_pin, pinmap->sclk_pin, pinmap->ssel_pin, hz, mode);
00093 }
00094 #endif
00095 
00096 #endif