/* * Copyright 2019 NXP * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ /*********************************************************************************************************************** * 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: Peripherals v7.0 processor: K32L3A60xxx package_id: K32L3A60VPJ1A mcu_data: ksdk2_0 processor_version: 0.0.1 board: FRDM-K32L3A6 functionalGroups: - name: BOARD_InitPeripherals_cm4 UUID: 42767dec-2704-4811-b21b-e31c81df8bb8 called_from_default_init: true selectedCore: cm4 - name: BOARD_InitPeripherals_cm0plus UUID: 2ad1928e-ffcd-48c1-b16d-1ec4f2bdddd8 selectedCore: cm0plus * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* component: - type: 'system' - type_id: 'system_54b53072540eeeb8f8e9343e71f28176' - global_system_definitions: [] * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* component: - type: 'msg' - type_id: 'msg_6e2baaf3b97dbeef01c0043275f9a0e7' - global_messages: [] * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* clang-format on */ /*********************************************************************************************************************** * Included files **********************************************************************************************************************/ #include "peripherals.h" /*********************************************************************************************************************** * BOARD_InitPeripherals_cm4 functional group **********************************************************************************************************************/ /*********************************************************************************************************************** * ACCEL initialization code **********************************************************************************************************************/ /* clang-format off */ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* instance: - name: 'ACCEL' - type: 'lpi2c' - mode: 'master' - custom_name_enabled: 'true' - type_id: 'lpi2c_db68d4f4f06a22e25ab51fe9bd6db4d2' - functional_group: 'BOARD_InitPeripherals_cm4' - peripheral: 'LPI2C3' - config_sets: - main: - clockSource: 'Lpi2cClock' - clockSourceFreq: 'GetIpFreq' - interrupt: - IRQn: 'LPI2C3_IRQn' - enable_priority: 'false' - priority: '0' - enable_custom_name: 'false' - quick_selection: 'qs_interrupt' - master: - mode: 'transfer' - config: - enableMaster: 'true' - enableDoze: 'true' - debugEnable: 'false' - ignoreAck: 'false' - pinConfig: 'kLPI2C_2PinOpenDrain' - baudRate_Hz: '100000' - busIdleTimeout_ns: '0' - pinLowTimeout_ns: '0' - sdaGlitchFilterWidth_ns: '0' - sclGlitchFilterWidth_ns: '0' - hostRequest: - enable: 'false' - source: 'kLPI2C_HostRequestExternalPin' - polarity: 'kLPI2C_HostRequestPinActiveHigh' - transfer: - blocking: 'false' - flags: '' - slaveAddress: '0' - direction: 'kLPI2C_Write' - subaddress: '0' - subaddressSize: '1' - dataSize: '1' - callback: - name: '' - userData: '' - quick_selection: 'qs_master_transfer' * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* clang-format on */ const lpi2c_master_config_t ACCEL_masterConfig = { .enableMaster = true, .enableDoze = true, .debugEnable = false, .ignoreAck = false, .pinConfig = kLPI2C_2PinOpenDrain, .baudRate_Hz = 100000, .busIdleTimeout_ns = 0, .pinLowTimeout_ns = 0, .sdaGlitchFilterWidth_ns = 0, .sclGlitchFilterWidth_ns = 0, .hostRequest = { .enable = false, .source = kLPI2C_HostRequestExternalPin, .polarity = kLPI2C_HostRequestPinActiveHigh } }; lpi2c_master_transfer_t ACCEL_masterTransfer = { .flags = kLPI2C_TransferDefaultFlag, .slaveAddress = 0, .direction = kLPI2C_Write, .subaddress = 0, .subaddressSize = 1, .data = ACCEL_masterBuffer, .dataSize = 1 }; lpi2c_master_handle_t ACCEL_masterHandle; uint8_t ACCEL_masterBuffer[ACCEL_MASTER_BUFFER_SIZE]; void ACCEL_init(void) { LPI2C_MasterInit(ACCEL_PERIPHERAL, &ACCEL_masterConfig, ACCEL_CLOCK_FREQ); LPI2C_MasterTransferCreateHandle(ACCEL_PERIPHERAL, &ACCEL_masterHandle, NULL, NULL); } /*********************************************************************************************************************** * DEBUG_UART initialization code **********************************************************************************************************************/ /* clang-format off */ /* TEXT BELOW IS USED AS SETTING FOR TOOLS ************************************* instance: - name: 'DEBUG_UART' - type: 'lpuart' - mode: 'polling' - custom_name_enabled: 'true' - type_id: 'lpuart_bebe3e12b6ec22bbd14199038f2bf459' - functional_group: 'BOARD_InitPeripherals_cm4' - peripheral: 'LPUART0' - config_sets: - lpuartConfig_t: - lpuartConfig: - clockSource: 'LpuartClock' - lpuartSrcClkFreq: 'BOARD_BootClockRUN' - baudRate_Bps: '115200' - parityMode: 'kLPUART_ParityDisabled' - dataBitsCount: 'kLPUART_EightDataBits' - isMsb: 'false' - stopBitCount: 'kLPUART_OneStopBit' - txFifoWatermark: '0' - rxFifoWatermark: '1' - enableRxRTS: 'false' - enableTxCTS: 'false' - txCtsSource: 'kLPUART_CtsSourcePin' - txCtsConfig: 'kLPUART_CtsSampleAtStart' - rxIdleType: 'kLPUART_IdleTypeStartBit' - rxIdleConfig: 'kLPUART_IdleCharacter1' - enableTx: 'true' - enableRx: 'true' * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/ /* clang-format on */ const lpuart_config_t DEBUG_UART_config = { .baudRate_Bps = 115200, .parityMode = kLPUART_ParityDisabled, .dataBitsCount = kLPUART_EightDataBits, .isMsb = false, .stopBitCount = kLPUART_OneStopBit, .txFifoWatermark = 0, .rxFifoWatermark = 1, .enableRxRTS = false, .enableTxCTS = false, .txCtsSource = kLPUART_CtsSourcePin, .txCtsConfig = kLPUART_CtsSampleAtStart, .rxIdleType = kLPUART_IdleTypeStartBit, .rxIdleConfig = kLPUART_IdleCharacter1, .enableTx = true, .enableRx = true }; void DEBUG_UART_init(void) { LPUART_Init(DEBUG_UART_PERIPHERAL, &DEBUG_UART_config, DEBUG_UART_CLOCK_SOURCE); } /*********************************************************************************************************************** * Initialization functions **********************************************************************************************************************/ void BOARD_InitPeripherals_cm4(void) { /* Initialize components */ ACCEL_init(); DEBUG_UART_init(); } /*********************************************************************************************************************** * BOARD_InitBootPeripherals function **********************************************************************************************************************/ void BOARD_InitBootPeripherals(void) { BOARD_InitPeripherals_cm4(); }