aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h
new file mode 100644
index 000000000..2711f7141
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/K32L2B21A/project_template/board.h
@@ -0,0 +1,182 @@
1/*
2 * Copyright 2019 NXP
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef _BOARD_H_
9#define _BOARD_H_
10
11#include "clock_config.h"
12#include "fsl_gpio.h"
13
14/*******************************************************************************
15 * Definitions
16 ******************************************************************************/
17
18/* The board name */
19#define BOARD_NAME "FRDM-K32L2B"
20
21/* The LPUART to use for debug messages. */
22#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
23#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART0
24#define BOARD_DEBUG_UART_INSTANCE 0U
25#define BOARD_DEBUG_UART_CLKSRC kCLOCK_McgIrc48MClk
26#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFreq(kCLOCK_McgIrc48MClk)
27#define BOARD_UART_IRQ LPUART0_IRQn
28#define BOARD_UART_IRQ_HANDLER LPUART0_IRQHandler
29
30#ifndef BOARD_DEBUG_UART_BAUDRATE
31#define BOARD_DEBUG_UART_BAUDRATE 115200
32#endif /* BOARD_DEBUG_UART_BAUDRATE */
33
34#define BOARD_ADC_USE_ALT_VREF 1U
35
36#define BOARD_TPM_BASEADDR TPM0
37#define BOARD_TPM_CHANNEL 5U
38
39/*! @brief The bubble level demo information */
40#define BOARD_BUBBLE_TPM_BASEADDR TPM0
41#define BOARD_TPM_X_CHANNEL 4U
42#define BOARD_TPM_Y_CHANNEL 5U
43#define BOARD_MMA8451_ADDR 0x1D
44#define BOARD_ACCEL_ADDR BOARD_MMA8451_ADDR
45#define BOARD_ACCEL_BAUDRATE 100
46#define BOARD_ACCEL_I2C_BASEADDR I2C0
47#define BOARD_ACCEL_I2C_CLOCK_FREQ CLOCK_GetFreq(I2C0_CLK_SRC)
48
49/*! @brief The rtc instance used for board. */
50#define BOARD_RTC_FUNC_BASEADDR RTC
51
52/*! @brief The Compare instance/channel used for board */
53#define BOARD_CMP_BASEADDR CMP0
54#define BOARD_CMP_CHANNEL 0U
55
56/*! @brief The i2c instance used for i2c connection by default */
57#define BOARD_I2C_BASEADDR I2C1
58
59/*! @brief The spi instance used for board. */
60#define BOARD_SPI_BASEADDR SPI1
61
62/*! @brief Define the port interrupt number for the board switches */
63#ifndef BOARD_SW1_GPIO
64#define BOARD_SW1_GPIO GPIOA
65#endif
66#ifndef BOARD_SW1_PORT
67#define BOARD_SW1_PORT PORTA
68#endif
69#ifndef BOARD_SW1_GPIO_PIN
70#define BOARD_SW1_GPIO_PIN 4U
71#endif
72#define BOARD_SW1_IRQ PORTA_IRQn
73#define BOARD_SW1_IRQ_HANDLER PORTA_IRQHandler
74#define BOARD_SW1_NAME "SW1"
75
76#ifndef BOARD_SW3_GPIO
77#define BOARD_SW3_GPIO GPIOC
78#endif
79#ifndef BOARD_SW3_PORT
80#define BOARD_SW3_PORT PORTC
81#endif
82#ifndef BOARD_SW3_GPIO_PIN
83#define BOARD_SW3_GPIO_PIN 3U
84#endif
85#define BOARD_SW3_IRQ PORTC_PORTD_IRQn
86#define BOARD_SW3_IRQ_HANDLER PORTC_PORTD_IRQHandler
87#define BOARD_SW3_NAME "SW3"
88
89#define LLWU_SW_GPIO BOARD_SW3_GPIO
90#define LLWU_SW_PORT BOARD_SW3_PORT
91#define LLWU_SW_GPIO_PIN BOARD_SW3_GPIO_PIN
92#define LLWU_SW_IRQ BOARD_SW3_IRQ
93#define LLWU_SW_IRQ_HANDLER BOARD_SW3_IRQ_HANDLER
94#define LLWU_SW_NAME BOARD_SW3_NAME
95
96/* Board led color mapping */
97#define LOGIC_LED_ON 0U
98#define LOGIC_LED_OFF 1U
99#ifndef BOARD_LED_RED_GPIO
100#define BOARD_LED_RED_GPIO GPIOE
101#endif
102#define BOARD_LED_RED_GPIO_PORT PORTE
103#ifndef BOARD_LED_RED_GPIO_PIN
104#define BOARD_LED_RED_GPIO_PIN 31U
105#endif
106#ifndef BOARD_LED_GREEN_GPIO
107#define BOARD_LED_GREEN_GPIO GPIOD
108#endif
109#define BOARD_LED_GREEN_GPIO_PORT PORTD
110#ifndef BOARD_LED_GREEN_GPIO_PIN
111#define BOARD_LED_GREEN_GPIO_PIN 5U
112#endif
113
114#define LED_RED_INIT(output) \
115 GPIO_PinWrite(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, output); \
116 BOARD_LED_RED_GPIO->PDDR |= (1U << BOARD_LED_RED_GPIO_PIN) /*!< Enable target LED_RED */
117#define LED_RED_ON() GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */
118#define LED_RED_OFF() GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
119#define LED_RED_TOGGLE() \
120 GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
121
122#define LED_GREEN_INIT(output) \
123 GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \
124 BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */
125#define LED_GREEN_ON() \
126 GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
127#define LED_GREEN_OFF() \
128 GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
129#define LED_GREEN_TOGGLE() \
130 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
131
132/* ERPC SPI configuration */
133#define ERPC_BOARD_SPI_BASEADDR SPI1
134#define ERPC_BOARD_SPI_BAUDRATE 500000U
135#define ERPC_BOARD_SPI_CLKSRC SPI1_CLK_SRC
136#define ERPC_BOARD_SPI_CLK_FREQ CLOCK_GetFreq(SPI1_CLK_SRC)
137#define ERPC_BOARD_SPI_INT_GPIO GPIOC
138#define ERPC_BOARD_SPI_INT_PORT PORTC
139#define ERPC_BOARD_SPI_INT_PIN 1U
140#define ERPC_BOARD_SPI_INT_PIN_IRQ PORTC_PORTD_IRQn
141#define ERPC_BOARD_SPI_INT_PIN_IRQ_HANDLER PORTC_PORTD_IRQHandler
142
143/* DAC base address */
144#define BOARD_DAC_BASEADDR DAC0
145
146/* Board accelerometer driver */
147#define BOARD_ACCEL_MMA
148
149#if defined(__cplusplus)
150extern "C" {
151#endif /* __cplusplus */
152
153/*******************************************************************************
154 * API
155 ******************************************************************************/
156
157void BOARD_InitDebugConsole(void);
158#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
159void BOARD_I2C_Init(I2C_Type *base, uint32_t clkSrc_Hz);
160status_t BOARD_I2C_Send(I2C_Type *base,
161 uint8_t deviceAddress,
162 uint32_t subAddress,
163 uint8_t subaddressSize,
164 uint8_t *txBuff,
165 uint8_t txBuffSize);
166status_t BOARD_I2C_Receive(I2C_Type *base,
167 uint8_t deviceAddress,
168 uint32_t subAddress,
169 uint8_t subaddressSize,
170 uint8_t *rxBuff,
171 uint8_t rxBuffSize);
172void BOARD_Accel_I2C_Init(void);
173status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff);
174status_t BOARD_Accel_I2C_Receive(
175 uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
176#endif /* SDK_I2C_BASED_COMPONENT_USED */
177
178#if defined(__cplusplus)
179}
180#endif /* __cplusplus */
181
182#endif /* _BOARD_H_ */