mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2025-03-23 04:52:56 +00:00
635 lines
32 KiB
C
635 lines
32 KiB
C
/*
|
|
* The Clear BSD License
|
|
* Copyright (c) 2016, Freescale Semiconductor, Inc.
|
|
* Copyright 2016-2017 NXP
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted (subject to the limitations in the disclaimer below) 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 Freescale Semiconductor, Inc. nor the names of its
|
|
* contributors may be used to endorse or promote products derived from this
|
|
* software without specific prior written permission.
|
|
*
|
|
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
|
|
* 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.
|
|
*/
|
|
|
|
/***********************************************************************************************************************
|
|
* This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
|
|
* will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
|
|
**********************************************************************************************************************/
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
!!GlobalInfo
|
|
product: Pins v4.0
|
|
processor: MKL27Z64xxx4
|
|
package_id: MKL27Z64VLH4
|
|
mcu_data: ksdk2_0
|
|
processor_version: 3.0.0
|
|
board: FRDM-KL27Z
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
#include "fsl_common.h"
|
|
#include "fsl_port.h"
|
|
#include "pin_mux.h"
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitBootPins
|
|
* Description : Calls initialization functions.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitBootPins(void)
|
|
{
|
|
BOARD_InitPins();
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitPins:
|
|
- options: {callFromInitBoot: 'true', prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list: []
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitPins
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitPins(void)
|
|
{
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitLEDs:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '29', peripheral: GPIOA, signal: 'GPIO, 13', pin_signal: PTA13/TPM1_CH1, direction: OUTPUT, slew_rate: slow, pull_select: down, pull_enable: disable}
|
|
- {pin_num: '41', peripheral: GPIOB, signal: 'GPIO, 18', pin_signal: PTB18/TPM2_CH0, direction: OUTPUT, slew_rate: slow, pull_select: down, pull_enable: disable}
|
|
- {pin_num: '42', peripheral: GPIOB, signal: 'GPIO, 19', pin_signal: PTB19/TPM2_CH1, direction: OUTPUT, slew_rate: slow, pull_select: down, pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitLEDs
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitLEDs(void)
|
|
{
|
|
/* Port A Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortA);
|
|
/* Port B Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortB);
|
|
|
|
const port_pin_config_t LED_BLUE = {/* Internal pull-up/down resistor is disabled */
|
|
kPORT_PullDisable,
|
|
/* Slow slew rate is configured */
|
|
kPORT_SlowSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as PTA13 */
|
|
kPORT_MuxAsGpio};
|
|
/* PORTA13 (pin 29) is configured as PTA13 */
|
|
PORT_SetPinConfig(BOARD_LED_BLUE_PORT, BOARD_LED_BLUE_PIN, &LED_BLUE);
|
|
|
|
const port_pin_config_t LED_RED = {/* Internal pull-up/down resistor is disabled */
|
|
kPORT_PullDisable,
|
|
/* Slow slew rate is configured */
|
|
kPORT_SlowSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as PTB18 */
|
|
kPORT_MuxAsGpio};
|
|
/* PORTB18 (pin 41) is configured as PTB18 */
|
|
PORT_SetPinConfig(BOARD_LED_RED_PORT, BOARD_LED_RED_PIN, &LED_RED);
|
|
|
|
const port_pin_config_t LED_GREEN = {/* Internal pull-up/down resistor is disabled */
|
|
kPORT_PullDisable,
|
|
/* Slow slew rate is configured */
|
|
kPORT_SlowSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as PTB19 */
|
|
kPORT_MuxAsGpio};
|
|
/* PORTB19 (pin 42) is configured as PTB19 */
|
|
PORT_SetPinConfig(BOARD_LED_GREEN_PORT, BOARD_LED_GREEN_PIN, &LED_GREEN);
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitButtons:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '26', peripheral: GPIOA, signal: 'GPIO, 4', pin_signal: PTA4/I2C1_SDA/TPM0_CH1/NMI_b, direction: INPUT, slew_rate: fast, pull_select: up, pull_enable: enable,
|
|
passive_filter: disable}
|
|
- {pin_num: '44', peripheral: GPIOC, signal: 'GPIO, 1', pin_signal: ADC0_SE15/PTC1/LLWU_P6/RTC_CLKIN/I2C1_SCL/TPM0_CH0, direction: INPUT, slew_rate: fast, pull_select: up,
|
|
pull_enable: enable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitButtons
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitButtons(void)
|
|
{
|
|
/* Port A Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortA);
|
|
/* Port C Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortC);
|
|
|
|
const port_pin_config_t SW1 = {/* Internal pull-up resistor is enabled */
|
|
kPORT_PullUp,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as PTA4 */
|
|
kPORT_MuxAsGpio};
|
|
/* PORTA4 (pin 26) is configured as PTA4 */
|
|
PORT_SetPinConfig(BOARD_SW1_PORT, BOARD_SW1_PIN, &SW1);
|
|
|
|
const port_pin_config_t SW3 = {/* Internal pull-up resistor is enabled */
|
|
kPORT_PullUp,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as PTC1 */
|
|
kPORT_MuxAsGpio};
|
|
/* PORTC1 (pin 44) is configured as PTC1 */
|
|
PORT_SetPinConfig(BOARD_SW3_PORT, BOARD_SW3_PIN, &SW3);
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitTSI:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '17', peripheral: GPIOE, signal: 'GPIO, 29', pin_signal: CMP0_IN5/ADC0_SE4b/PTE29/TPM0_CH2/TPM_CLKIN0, direction: INPUT, slew_rate: slow, pull_select: up,
|
|
pull_enable: disable}
|
|
- {pin_num: '18', peripheral: GPIOE, signal: 'GPIO, 30', pin_signal: ADC0_SE23/CMP0_IN4/PTE30/TPM0_CH3/TPM_CLKIN1/LPUART1_TX/LPTMR0_ALT1, direction: INPUT, slew_rate: slow,
|
|
pull_select: up, pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitTSI
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitTSI(void)
|
|
{
|
|
/* Port E Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortE);
|
|
|
|
/* PORTE29 (pin 17) is configured as PTE29 */
|
|
PORT_SetPinMux(BOARD_TOUCH_A_PORT, BOARD_TOUCH_A_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTE->PCR[29] = ((PORTE->PCR[29] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Slow slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_SlowSlewRate));
|
|
|
|
/* PORTE30 (pin 18) is configured as PTE30 */
|
|
PORT_SetPinMux(BOARD_TOUCH_B_PORT, BOARD_TOUCH_B_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTE->PCR[30] = ((PORTE->PCR[30] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Slow slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_SlowSlewRate));
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitUSB:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '5', peripheral: USB0, signal: DP, pin_signal: USB0_DP}
|
|
- {pin_num: '6', peripheral: USB0, signal: DM, pin_signal: USB0_DM}
|
|
- {pin_num: '27', peripheral: USB0, signal: CLKIN, pin_signal: PTA5/USB_CLKIN/TPM0_CH2, slew_rate: fast, pull_select: up, pull_enable: disable}
|
|
- {pin_num: '7', peripheral: USB0, signal: VDD, pin_signal: USB_VDD}
|
|
- {pin_num: '43', peripheral: USB0, signal: SOF_OUT, pin_signal: ADC0_SE14/PTC0/EXTRG_IN/USB_SOF_OUT/CMP0_OUT, slew_rate: fast, pull_select: up, pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitUSB
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitUSB(void)
|
|
{
|
|
/* Port A Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortA);
|
|
/* Port C Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortC);
|
|
|
|
/* PORTA5 (pin 27) is configured as USB_CLKIN */
|
|
PORT_SetPinMux(BOARD_TPM0_CH2_PORT, BOARD_TPM0_CH2_PIN, kPORT_MuxAlt2);
|
|
|
|
PORTA->PCR[5] = ((PORTA->PCR[5] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Fast slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_FastSlewRate));
|
|
|
|
/* PORTC0 (pin 43) is configured as USB_SOF_OUT */
|
|
PORT_SetPinMux(BOARD_USB_SOF_OUT_PORT, BOARD_USB_SOF_OUT_PIN, kPORT_MuxAlt4);
|
|
|
|
PORTC->PCR[0] = ((PORTC->PCR[0] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Fast slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_FastSlewRate));
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitACCEL_I2C:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '46', peripheral: GPIOC, signal: 'GPIO, 3', pin_signal: PTC3/LLWU_P7/SPI1_SCK/LPUART1_RX/TPM0_CH2/CLKOUT, direction: INPUT, drive_strength: low, pull_select: up,
|
|
pull_enable: disable}
|
|
- {pin_num: '45', peripheral: GPIOC, signal: 'GPIO, 2', pin_signal: ADC0_SE11/PTC2/I2C1_SDA/TPM0_CH1, identifier: INT2_ACCEL, direction: INPUT, slew_rate: fast,
|
|
pull_select: up, pull_enable: disable}
|
|
- {pin_num: '63', peripheral: I2C1, signal: SDA, pin_signal: ADC0_SE7b/PTD6/LLWU_P15/SPI1_MOSI/LPUART0_RX/I2C1_SDA/SPI1_MISO/FXIO0_D6, identifier: ACCEL_I2C1_SDA}
|
|
- {pin_num: '64', peripheral: I2C1, signal: SCL, pin_signal: PTD7/SPI1_MISO/LPUART0_TX/I2C1_SCL/SPI1_MOSI/FXIO0_D7, identifier: ACCEL_I2C1_SCL}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitACCEL_I2C
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitACCEL_I2C(void)
|
|
{
|
|
/* Port C Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortC);
|
|
/* Port D Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortD);
|
|
|
|
/* PORTC2 (pin 45) is configured as PTC2 */
|
|
PORT_SetPinMux(BOARD_INT2_ACCEL_PORT, BOARD_INT2_ACCEL_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTC->PCR[2] = ((PORTC->PCR[2] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Fast slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_FastSlewRate));
|
|
|
|
/* PORTC3 (pin 46) is configured as PTC3 */
|
|
PORT_SetPinMux(BOARD_INT1_ACCEL_PORT, BOARD_INT1_ACCEL_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTC->PCR[3] = ((PORTC->PCR[3] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_DSE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Drive Strength Enable: Low drive strength is configured on the corresponding pin, if pin
|
|
* is configured as a digital output. */
|
|
| PORT_PCR_DSE(kPORT_LowDriveStrength));
|
|
|
|
/* PORTD6 (pin 63) is configured as I2C1_SDA */
|
|
PORT_SetPinMux(BOARD_ACCEL_I2C1_SDA_PORT, BOARD_ACCEL_I2C1_SDA_PIN, kPORT_MuxAlt4);
|
|
|
|
/* PORTD7 (pin 64) is configured as I2C1_SCL */
|
|
PORT_SetPinMux(BOARD_ACCEL_I2C1_SCL_PORT, BOARD_ACCEL_I2C1_SCL_PIN, kPORT_MuxAlt4);
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitMAGNET_I2C:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '64', peripheral: I2C1, signal: SCL, pin_signal: PTD7/SPI1_MISO/LPUART0_TX/I2C1_SCL/SPI1_MOSI/FXIO0_D7, identifier: MAG_I2C1_SCL, slew_rate: fast, drive_strength: low,
|
|
pull_select: up, pull_enable: enable}
|
|
- {pin_num: '63', peripheral: I2C1, signal: SDA, pin_signal: ADC0_SE7b/PTD6/LLWU_P15/SPI1_MOSI/LPUART0_RX/I2C1_SDA/SPI1_MISO/FXIO0_D6, identifier: MAG_I2C1_SDA,
|
|
slew_rate: fast, drive_strength: low, pull_select: up, pull_enable: enable}
|
|
- {pin_num: '45', peripheral: GPIOC, signal: 'GPIO, 2', pin_signal: ADC0_SE11/PTC2/I2C1_SDA/TPM0_CH1, identifier: INT1_MAG, direction: INPUT, slew_rate: fast, pull_select: up,
|
|
pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitMAGNET_I2C
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitMAGNET_I2C(void)
|
|
{
|
|
/* Port C Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortC);
|
|
/* Port D Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortD);
|
|
|
|
/* PORTC2 (pin 45) is configured as PTC2 */
|
|
PORT_SetPinMux(BOARD_INT1_MAG_PORT, BOARD_INT1_MAG_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTC->PCR[2] = ((PORTC->PCR[2] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Fast slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_FastSlewRate));
|
|
|
|
const port_pin_config_t MAG_I2C1_SDA = {/* Internal pull-up resistor is enabled */
|
|
kPORT_PullUp,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as I2C1_SDA */
|
|
kPORT_MuxAlt4};
|
|
/* PORTD6 (pin 63) is configured as I2C1_SDA */
|
|
PORT_SetPinConfig(BOARD_MAG_I2C1_SDA_PORT, BOARD_MAG_I2C1_SDA_PIN, &MAG_I2C1_SDA);
|
|
|
|
const port_pin_config_t MAG_I2C1_SCL = {/* Internal pull-up resistor is enabled */
|
|
kPORT_PullUp,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as I2C1_SCL */
|
|
kPORT_MuxAlt4};
|
|
/* PORTD7 (pin 64) is configured as I2C1_SCL */
|
|
PORT_SetPinConfig(BOARD_MAG_I2C1_SCL_PORT, BOARD_MAG_I2C1_SCL_PIN, &MAG_I2C1_SCL);
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitDEBUG_UART:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '23', peripheral: LPUART0, signal: RX, pin_signal: PTA1/LPUART0_RX/TPM2_CH0, slew_rate: fast, pull_select: down, pull_enable: disable}
|
|
- {pin_num: '24', peripheral: LPUART0, signal: TX, pin_signal: PTA2/LPUART0_TX/TPM2_CH1, direction: OUTPUT, slew_rate: fast, pull_select: down, pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitDEBUG_UART
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitDEBUG_UART(void)
|
|
{
|
|
/* Port A Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortA);
|
|
|
|
const port_pin_config_t DEBUG_UART0_RX = {/* Internal pull-up/down resistor is disabled */
|
|
kPORT_PullDisable,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as LPUART0_RX */
|
|
kPORT_MuxAlt2};
|
|
/* PORTA1 (pin 23) is configured as LPUART0_RX */
|
|
PORT_SetPinConfig(BOARD_DEBUG_UART0_RX_PORT, BOARD_DEBUG_UART0_RX_PIN, &DEBUG_UART0_RX);
|
|
|
|
const port_pin_config_t DEBUG_UART0_TX = {/* Internal pull-up/down resistor is disabled */
|
|
kPORT_PullDisable,
|
|
/* Fast slew rate is configured */
|
|
kPORT_FastSlewRate,
|
|
/* Passive filter is disabled */
|
|
kPORT_PassiveFilterDisable,
|
|
/* Low drive strength is configured */
|
|
kPORT_LowDriveStrength,
|
|
/* Pin is configured as LPUART0_TX */
|
|
kPORT_MuxAlt2};
|
|
/* PORTA2 (pin 24) is configured as LPUART0_TX */
|
|
PORT_SetPinConfig(BOARD_DEBUG_UART0_TX_PORT, BOARD_DEBUG_UART0_TX_PIN, &DEBUG_UART0_TX);
|
|
|
|
SIM->SOPT5 = ((SIM->SOPT5 &
|
|
/* Mask bits to zero which are setting */
|
|
(~(SIM_SOPT5_LPUART0TXSRC_MASK | SIM_SOPT5_LPUART0RXSRC_MASK)))
|
|
|
|
/* LPUART0 Transmit Data Source Select: LPUART0_TX pin. */
|
|
| SIM_SOPT5_LPUART0TXSRC(SOPT5_LPUART0TXSRC_LPUART_TX)
|
|
|
|
/* LPUART0 Receive Data Source Select: LPUART_RX pin. */
|
|
| SIM_SOPT5_LPUART0RXSRC(SOPT5_LPUART0RXSRC_LPUART_RX));
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitTHER:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '11', peripheral: GPIOE, signal: 'GPIO, 22', pin_signal: ADC0_DP3/ADC0_SE3/PTE22/TPM2_CH0/UART2_TX/FXIO0_D6, direction: INPUT, slew_rate: slow, pull_select: up,
|
|
pull_enable: disable}
|
|
- {pin_num: '12', peripheral: GPIOE, signal: 'GPIO, 23', pin_signal: ADC0_DM3/ADC0_SE7a/PTE23/TPM2_CH1/UART2_RX/FXIO0_D7, direction: INPUT, slew_rate: slow, pull_select: up,
|
|
pull_enable: disable}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitTHER
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitTHER(void)
|
|
{
|
|
/* Port E Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortE);
|
|
|
|
/* PORTE22 (pin 11) is configured as PTE22 */
|
|
PORT_SetPinMux(BOARD_THER_A_PORT, BOARD_THER_A_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTE->PCR[22] = ((PORTE->PCR[22] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Slow slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_SlowSlewRate));
|
|
|
|
/* PORTE23 (pin 12) is configured as PTE23 */
|
|
PORT_SetPinMux(BOARD_THER_B_PORT, BOARD_THER_B_PIN, kPORT_MuxAsGpio);
|
|
|
|
PORTE->PCR[23] = ((PORTE->PCR[23] &
|
|
/* Mask bits to zero which are setting */
|
|
(~(PORT_PCR_PS_MASK | PORT_PCR_PE_MASK | PORT_PCR_SRE_MASK | PORT_PCR_ISF_MASK)))
|
|
|
|
/* Pull Select: Internal pullup resistor is enabled on the corresponding pin, if the
|
|
* corresponding PE field is set. */
|
|
| PORT_PCR_PS(kPORT_PullUp)
|
|
|
|
/* Pull Enable: Internal pullup or pulldown resistor is not enabled on the corresponding pin. */
|
|
| PORT_PCR_PE(kPORT_PullDisable)
|
|
|
|
/* Slew Rate Enable: Slow slew rate is configured on the corresponding pin, if the pin is
|
|
* configured as a digital output. */
|
|
| PORT_PCR_SRE(kPORT_SlowSlewRate));
|
|
}
|
|
|
|
/* clang-format off */
|
|
/*
|
|
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
|
|
BOARD_InitOSC:
|
|
- options: {prefix: BOARD_, coreID: core0, enableClock: 'true'}
|
|
- pin_list:
|
|
- {pin_num: '32', peripheral: OSC0, signal: EXTAL0, pin_signal: EXTAL0/PTA18/LPUART1_RX/TPM_CLKIN0, slew_rate: no_init, pull_select: no_init, pull_enable: no_init}
|
|
- {pin_num: '33', peripheral: OSC0, signal: XTAL0, pin_signal: XTAL0/PTA19/LPUART1_TX/TPM_CLKIN1/LPTMR0_ALT1, slew_rate: no_init, pull_select: no_init, pull_enable: no_init}
|
|
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
|
|
*/
|
|
/* clang-format on */
|
|
|
|
/* FUNCTION ************************************************************************************************************
|
|
*
|
|
* Function Name : BOARD_InitOSC
|
|
* Description : Configures pin routing and optionally pin electrical features.
|
|
*
|
|
* END ****************************************************************************************************************/
|
|
void BOARD_InitOSC(void)
|
|
{
|
|
/* Port A Clock Gate Control: Clock enabled */
|
|
CLOCK_EnableClock(kCLOCK_PortA);
|
|
|
|
/* PORTA18 (pin 32) is configured as EXTAL0 */
|
|
PORT_SetPinMux(BOARD_EXTAL0_PORT, BOARD_EXTAL0_PIN, kPORT_PinDisabledOrAnalog);
|
|
|
|
/* PORTA19 (pin 33) is configured as XTAL0 */
|
|
PORT_SetPinMux(BOARD_XTAL0_PORT, BOARD_XTAL0_PIN, kPORT_PinDisabledOrAnalog);
|
|
}
|
|
/***********************************************************************************************************************
|
|
* EOF
|
|
**********************************************************************************************************************/
|