/* * Copyright (c) 2016, Freescale Semiconductor, Inc. * Copyright 2016-2017 NXP * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * o Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * TEXT BELOW IS USED AS SETTING FOR THE PINS TOOL ***************************** PinsProfile: - !!product 'Pins v2.0' - !!processor 'MKL25Z128xxx4' - !!package 'MKL25Z128VLK4' - !!mcu_data 'ksdk2_0' - !!processor_version '1.1.0' * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE PINS TOOL *** */ #include "fsl_common.h" #include "fsl_port.h" #include "pin_mux.h" #define PIN1_IDX 1u /*!< Pin number for pin 1 in a port */ #define PIN2_IDX 2u /*!< Pin number for pin 2 in a port */ #define SOPT5_UART0RXSRC_UART_RX 0x00u /*!< UART0 receive data source select: UART0_RX pin */ #define SOPT5_UART0TXSRC_UART_TX 0x00u /*!< UART0 transmit data source select: UART0_TX pin */ /* * TEXT BELOW IS USED AS SETTING FOR THE PINS TOOL ***************************** BOARD_InitPins: - options: {coreID: singlecore, enableClock: 'true'} - pin_list: - {pin_num: '28', peripheral: UART0, signal: TX, pin_signal: TSI0_CH3/PTA2/UART0_TX/TPM2_CH1} - {pin_num: '27', peripheral: UART0, signal: RX, pin_signal: TSI0_CH2/PTA1/UART0_RX/TPM2_CH0} * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE PINS TOOL *** */ /*FUNCTION********************************************************************** * * Function Name : BOARD_InitPins * Description : Configures pin routing and optionally pin electrical features. * *END**************************************************************************/ void BOARD_InitPins(void) { CLOCK_EnableClock(kCLOCK_PortA); /* Port A Clock Gate Control: Clock enabled */ PORT_SetPinMux(PORTA, PIN1_IDX, kPORT_MuxAlt2); /* PORTA1 (pin 27) is configured as UART0_RX */ PORT_SetPinMux(PORTA, PIN2_IDX, kPORT_MuxAlt2); /* PORTA2 (pin 28) is configured as UART0_TX */ SIM->SOPT5 = ((SIM->SOPT5 & (~(SIM_SOPT5_UART0TXSRC_MASK | SIM_SOPT5_UART0RXSRC_MASK))) /* Mask bits to zero which are setting */ | SIM_SOPT5_UART0TXSRC(SOPT5_UART0TXSRC_UART_TX) /* UART0 transmit data source select: UART0_TX pin */ | SIM_SOPT5_UART0RXSRC(SOPT5_UART0RXSRC_UART_RX) /* UART0 receive data source select: UART0_RX pin */ ); } /******************************************************************************* * EOF ******************************************************************************/