1 /*
2 * Copyright 2019 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 /***********************************************************************************************************************
9 * This file was generated by the MCUXpresso Config Tools. Any manual edits made to this file
10 * will be overwritten if the respective MCUXpresso Config Tools is used to update this file.
11 **********************************************************************************************************************/
12
13 /* clang-format off */
14 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
15 !!GlobalInfo
16 product: Peripherals v7.0
17 processor: K32L3A60xxx
18 package_id: K32L3A60VPJ1A
19 mcu_data: ksdk2_0
20 processor_version: 0.0.1
21 board: FRDM-K32L3A6
22 functionalGroups:
23 - name: BOARD_InitPeripherals_cm4
24 UUID: 42767dec-2704-4811-b21b-e31c81df8bb8
25 called_from_default_init: true
26 selectedCore: cm4
27 - name: BOARD_InitPeripherals_cm0plus
28 UUID: 2ad1928e-ffcd-48c1-b16d-1ec4f2bdddd8
29 selectedCore: cm0plus
30 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
31
32 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
33 component:
34 - type: 'system'
35 - type_id: 'system_54b53072540eeeb8f8e9343e71f28176'
36 - global_system_definitions: []
37 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
38
39 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
40 component:
41 - type: 'msg'
42 - type_id: 'msg_6e2baaf3b97dbeef01c0043275f9a0e7'
43 - global_messages: []
44 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
45 /* clang-format on */
46
47 /***********************************************************************************************************************
48 * Included files
49 **********************************************************************************************************************/
50 #include "peripherals.h"
51
52 /***********************************************************************************************************************
53 * BOARD_InitPeripherals_cm4 functional group
54 **********************************************************************************************************************/
55 /***********************************************************************************************************************
56 * ACCEL initialization code
57 **********************************************************************************************************************/
58 /* clang-format off */
59 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
60 instance:
61 - name: 'ACCEL'
62 - type: 'lpi2c'
63 - mode: 'master'
64 - custom_name_enabled: 'true'
65 - type_id: 'lpi2c_db68d4f4f06a22e25ab51fe9bd6db4d2'
66 - functional_group: 'BOARD_InitPeripherals_cm4'
67 - peripheral: 'LPI2C3'
68 - config_sets:
69 - main:
70 - clockSource: 'Lpi2cClock'
71 - clockSourceFreq: 'GetIpFreq'
72 - interrupt:
73 - IRQn: 'LPI2C3_IRQn'
74 - enable_priority: 'false'
75 - priority: '0'
76 - enable_custom_name: 'false'
77 - quick_selection: 'qs_interrupt'
78 - master:
79 - mode: 'transfer'
80 - config:
81 - enableMaster: 'true'
82 - enableDoze: 'true'
83 - debugEnable: 'false'
84 - ignoreAck: 'false'
85 - pinConfig: 'kLPI2C_2PinOpenDrain'
86 - baudRate_Hz: '100000'
87 - busIdleTimeout_ns: '0'
88 - pinLowTimeout_ns: '0'
89 - sdaGlitchFilterWidth_ns: '0'
90 - sclGlitchFilterWidth_ns: '0'
91 - hostRequest:
92 - enable: 'false'
93 - source: 'kLPI2C_HostRequestExternalPin'
94 - polarity: 'kLPI2C_HostRequestPinActiveHigh'
95 - transfer:
96 - blocking: 'false'
97 - flags: ''
98 - slaveAddress: '0'
99 - direction: 'kLPI2C_Write'
100 - subaddress: '0'
101 - subaddressSize: '1'
102 - dataSize: '1'
103 - callback:
104 - name: ''
105 - userData: ''
106 - quick_selection: 'qs_master_transfer'
107 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
108 /* clang-format on */
109 const lpi2c_master_config_t ACCEL_masterConfig = {
110 .enableMaster = true,
111 .enableDoze = true,
112 .debugEnable = false,
113 .ignoreAck = false,
114 .pinConfig = kLPI2C_2PinOpenDrain,
115 .baudRate_Hz = 100000,
116 .busIdleTimeout_ns = 0,
117 .pinLowTimeout_ns = 0,
118 .sdaGlitchFilterWidth_ns = 0,
119 .sclGlitchFilterWidth_ns = 0,
120 .hostRequest = {
121 .enable = false,
122 .source = kLPI2C_HostRequestExternalPin,
123 .polarity = kLPI2C_HostRequestPinActiveHigh
124 }
125 };
126 lpi2c_master_transfer_t ACCEL_masterTransfer = {
127 .flags = kLPI2C_TransferDefaultFlag,
128 .slaveAddress = 0,
129 .direction = kLPI2C_Write,
130 .subaddress = 0,
131 .subaddressSize = 1,
132 .data = ACCEL_masterBuffer,
133 .dataSize = 1
134 };
135 lpi2c_master_handle_t ACCEL_masterHandle;
136 uint8_t ACCEL_masterBuffer[ACCEL_MASTER_BUFFER_SIZE];
137
ACCEL_init(void)138 void ACCEL_init(void) {
139 LPI2C_MasterInit(ACCEL_PERIPHERAL, &ACCEL_masterConfig, ACCEL_CLOCK_FREQ);
140 LPI2C_MasterTransferCreateHandle(ACCEL_PERIPHERAL, &ACCEL_masterHandle, NULL, NULL);
141 }
142
143 /***********************************************************************************************************************
144 * DEBUG_UART initialization code
145 **********************************************************************************************************************/
146 /* clang-format off */
147 /* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
148 instance:
149 - name: 'DEBUG_UART'
150 - type: 'lpuart'
151 - mode: 'polling'
152 - custom_name_enabled: 'true'
153 - type_id: 'lpuart_bebe3e12b6ec22bbd14199038f2bf459'
154 - functional_group: 'BOARD_InitPeripherals_cm4'
155 - peripheral: 'LPUART0'
156 - config_sets:
157 - lpuartConfig_t:
158 - lpuartConfig:
159 - clockSource: 'LpuartClock'
160 - lpuartSrcClkFreq: 'BOARD_BootClockRUN'
161 - baudRate_Bps: '115200'
162 - parityMode: 'kLPUART_ParityDisabled'
163 - dataBitsCount: 'kLPUART_EightDataBits'
164 - isMsb: 'false'
165 - stopBitCount: 'kLPUART_OneStopBit'
166 - txFifoWatermark: '0'
167 - rxFifoWatermark: '1'
168 - enableRxRTS: 'false'
169 - enableTxCTS: 'false'
170 - txCtsSource: 'kLPUART_CtsSourcePin'
171 - txCtsConfig: 'kLPUART_CtsSampleAtStart'
172 - rxIdleType: 'kLPUART_IdleTypeStartBit'
173 - rxIdleConfig: 'kLPUART_IdleCharacter1'
174 - enableTx: 'true'
175 - enableRx: 'true'
176 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
177 /* clang-format on */
178 const lpuart_config_t DEBUG_UART_config = {
179 .baudRate_Bps = 115200,
180 .parityMode = kLPUART_ParityDisabled,
181 .dataBitsCount = kLPUART_EightDataBits,
182 .isMsb = false,
183 .stopBitCount = kLPUART_OneStopBit,
184 .txFifoWatermark = 0,
185 .rxFifoWatermark = 1,
186 .enableRxRTS = false,
187 .enableTxCTS = false,
188 .txCtsSource = kLPUART_CtsSourcePin,
189 .txCtsConfig = kLPUART_CtsSampleAtStart,
190 .rxIdleType = kLPUART_IdleTypeStartBit,
191 .rxIdleConfig = kLPUART_IdleCharacter1,
192 .enableTx = true,
193 .enableRx = true
194 };
195
DEBUG_UART_init(void)196 void DEBUG_UART_init(void) {
197 LPUART_Init(DEBUG_UART_PERIPHERAL, &DEBUG_UART_config, DEBUG_UART_CLOCK_SOURCE);
198 }
199
200 /***********************************************************************************************************************
201 * Initialization functions
202 **********************************************************************************************************************/
BOARD_InitPeripherals_cm4(void)203 void BOARD_InitPeripherals_cm4(void)
204 {
205 /* Initialize components */
206 ACCEL_init();
207 DEBUG_UART_init();
208 }
209
210 /***********************************************************************************************************************
211 * BOARD_InitBootPeripherals function
212 **********************************************************************************************************************/
BOARD_InitBootPeripherals(void)213 void BOARD_InitBootPeripherals(void)
214 {
215 BOARD_InitPeripherals_cm4();
216 }
217