aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h205
1 files changed, 205 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h
new file mode 100644
index 000000000..46f5fa400
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK28FA15/project_template/board.h
@@ -0,0 +1,205 @@
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef _BOARD_H_
10#define _BOARD_H_
11
12#include "clock_config.h"
13#include "fsl_gpio.h"
14
15/*******************************************************************************
16 * Definitions
17 ******************************************************************************/
18/*! @brief The board name */
19#define BOARD_NAME "FRDM-K28FA"
20
21/*! @brief The UART to use for debug messages. */
22#define BOARD_USE_UART
23#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_LPUART
24#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART0
25#define BOARD_DEBUG_UART_INSTANCE 0U
26#define BOARD_DEBUG_UART_CLKSRC kCLOCK_Osc0ErClk
27#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetOsc0ErClkFreq()
28#define BOARD_UART_IRQ LPUART0_IRQn
29#define BOARD_UART_IRQ_HANDLER LPUART0_IRQHandler
30
31#ifndef BOARD_DEBUG_UART_BAUDRATE
32#define BOARD_DEBUG_UART_BAUDRATE 115200
33#endif /* BOARD_DEBUG_UART_BAUDRATE */
34
35/*! @brief The i2c instance used for i2c connection by default */
36#define BOARD_I2C_BASEADDR I2C3
37
38/*! @brief The bubble level demo information */
39#define BOARD_FXOS8700_ADDR 0x1C
40#define BOARD_ACCEL_ADDR BOARD_FXOS8700_ADDR
41#define BOARD_ACCEL_BAUDRATE 100
42#define BOARD_ACCEL_I2C_BASEADDR I2C3
43
44/*! @brief The TPM instance/channel used for board */
45#define BOARD_TPM_BASEADDR TPM2
46#define BOARD_TPM_CHANNEL 0U
47
48/*! @brief The FlexBus instance used for board.*/
49#define BOARD_FLEXBUS_BASEADDR FB
50
51#define BOARD_TSI_ELECTRODE_CNT 2U
52
53/*! @brief Indexes of the TSI channels for on board electrodes */
54#ifndef BOARD_TSI_ELECTRODE_1
55#define BOARD_TSI_ELECTRODE_1 11U
56#endif
57#ifndef BOARD_TSI_ELECTRODE_2
58#define BOARD_TSI_ELECTRODE_2 12U
59#endif
60
61/*! @brief The SDHC instance/channel used for board */
62#define BOARD_SDHC_BASEADDR SDHC
63
64/*! @brief The CMP instance/channel used for board. */
65#define BOARD_CMP_BASEADDR CMP1
66#define BOARD_CMP_CHANNEL 3U
67
68/*! @brief The i2c instance used for sai demo */
69#define BOARD_SAI_DEMO_I2C_BASEADDR I2C0
70
71/*! @brief The rtc instance used for rtc_func */
72#define BOARD_RTC_FUNC_BASEADDR RTC
73
74/*! @brief If connected the TWR_MEM, this is spi sd card */
75#ifndef BOARD_SDCARD_CARD_DETECTION_GPIO
76#define BOARD_SDCARD_CARD_DETECTION_GPIO GPIOD
77#endif
78#define BOARD_SDCARD_CARD_DETECTION_GPIO_PORT PORTD
79#define SDCARD_CARD_DETECTION_GPIO_PIN 15U
80#define SDCARD_CARD_WRITE_PROTECTION_GPIO GPIOC
81#define SDCARD_CARD_WRITE_PROTECTION_GPIO_PORT PORTC
82#define SDCARD_CARD_WRITE_PROTECTION_GPIO_PIN 13U
83#define SDCARD_SPI_HW_BASEADDR SPI1
84#define SDCARD_CARD_INSERTED 0U
85
86/* Board led color mapping */
87#define LOGIC_LED_ON 1U
88#define LOGIC_LED_OFF 0U
89#ifndef BOARD_LED_RED_GPIO
90#define BOARD_LED_RED_GPIO GPIOE
91#endif
92#define BOARD_LED_RED_GPIO_PORT PORTE
93#ifndef BOARD_LED_RED_GPIO_PIN
94#define BOARD_LED_RED_GPIO_PIN 6U
95#endif
96#ifndef BOARD_LED_GREEN_GPIO
97#define BOARD_LED_GREEN_GPIO GPIOE
98#endif
99#define BOARD_LED_GREEN_GPIO_PORT PORTE
100#ifndef BOARD_LED_GREEN_GPIO_PIN
101#define BOARD_LED_GREEN_GPIO_PIN 7U
102#endif
103#ifndef BOARD_LED_BLUE_GPIO
104#define BOARD_LED_BLUE_GPIO GPIOE
105#endif
106#define BOARD_LED_BLUE_GPIO_PORT PORTE
107#ifndef BOARD_LED_BLUE_GPIO_PIN
108#define BOARD_LED_BLUE_GPIO_PIN 8U
109#endif
110
111#define LED_RED_INIT(output) \
112 GPIO_PinWrite(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, output); \
113 BOARD_LED_RED_GPIO->PDDR |= (1U << BOARD_LED_RED_GPIO_PIN) /*!< Enable target LED_RED */
114
115#define LED_RED_ON() \
116 GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED \ \
117 */
118#define LED_RED_OFF() \
119 GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
120#define LED_RED_TOGGLE() \
121 GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
122
123#define LED_GREEN_INIT(output) \
124 GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \
125 BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */
126#define LED_GREEN_ON() \
127 GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
128#define LED_GREEN_OFF() \
129 GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
130#define LED_GREEN_TOGGLE() \
131 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
132
133#define LED_BLUE_INIT(output) \
134 GPIO_PinWrite(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, output); \
135 BOARD_LED_BLUE_GPIO->PDDR |= (1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Enable target LED_BLUE */
136#define LED_BLUE_ON() \
137 GPIO_PortSet(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */
138#define LED_BLUE_OFF() \
139 GPIO_PortClear(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */
140#define LED_BLUE_TOGGLE() \
141 GPIO_PortToggle(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */
142
143/* FLEXIO */
144#define BOARD_FLEXIO_I2C_INSTANCE (1)
145#define BOARD_FLEXIO_I2C_INSTANCE_BASE (I2C1)
146#define BOARD_FLEXIO_INSTANCE (0)
147#define BOARD_FLEXIO_INSTANCE_BASE (FLEXIO0)
148#define BOARD_FLEXIO_DATA_PINS (8)
149#define BOARD_FLEXIO_DATA_PIN_START_INDEX (16)
150#define BOARD_FLEXIO_DATA_PIN_END_INDEX (23)
151#define BOARD_FLEXIO_PCLK_PIN_INDEX (6)
152#define BOARD_FLEXIO_HREF_PIN_INDEX (7)
153#define BOARD_FLEXIO_VSYNC_PORT_INDEX (0)
154#define BOARD_FLEXIO_VSYNC_PIN_INDEX (20)
155#define BOARD_FLEXIO_CLCK_OUT_PORT_INDEX (0)
156#define BOARD_FLEXIO_CLCK_OUT_PIN_INDEX (6)
157#define BOARD_FLEXIO_RESET_PORT_INDEX (0)
158#define BOARD_FLEXIO_RESET_PIN_INDEX (5)
159
160/* SDHC base address, clock and card detection pin */
161#define BOARD_SDHC_BASEADDR SDHC
162#define BOARD_SDHC_CLKSRC kCLOCK_CoreSysClk
163#define BOARD_SDHC_CLK_FREQ CLOCK_GetFreq(kCLOCK_CoreSysClk)
164#define BOARD_SDHC_IRQ SDHC_IRQn
165#define BOARD_SDHC_CD_GPIO_BASE GPIOB
166#ifndef BOARD_SDHC_CD_GPIO_PIN
167#define BOARD_SDHC_CD_GPIO_PIN 5U
168#endif
169#define BOARD_SDHC_CD_PORT_BASE PORTB
170#define BOARD_SDHC_CD_PORT_IRQ PORTB_IRQn
171#define BOARD_SDHC_CD_PORT_IRQ_HANDLER PORTB_IRQHandler
172#define BOARD_SDHC_CD_LOGIC_RISING
173
174/* ERPC DSPI configuration */
175#define ERPC_BOARD_DSPI_BASEADDR SPI0
176#define ERPC_BOARD_DSPI_BAUDRATE 500000U
177#define ERPC_BOARD_DSPI_CLKSRC DSPI0_CLK_SRC
178#define ERPC_BOARD_DSPI_CLK_FREQ CLOCK_GetFreq(DSPI0_CLK_SRC)
179#define ERPC_BOARD_DSPI_INT_GPIO GPIOC
180#define ERPC_BOARD_DSPI_INT_PORT PORTC
181#define ERPC_BOARD_DSPI_INT_PIN 11U
182#define ERPC_BOARD_DSPI_INT_PIN_IRQ PORTC_IRQn
183#define ERPC_BOARD_DSPI_INT_PIN_IRQ_HANDLER PORTC_IRQHandler
184
185/* DAC base address */
186#define BOARD_DAC_BASEADDR DAC0
187
188/* Board accelerometer driver */
189#define BOARD_ACCEL_FXOS
190
191#if defined(__cplusplus)
192extern "C" {
193#endif /* __cplusplus */
194
195/*******************************************************************************
196 * API
197 ******************************************************************************/
198
199void BOARD_InitDebugConsole(void);
200
201#if defined(__cplusplus)
202}
203#endif /* __cplusplus */
204
205#endif /* _BOARD_H_ */