aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h172
1 files changed, 172 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h
new file mode 100644
index 000000000..9839287ae
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/frdmk32l3a6/project_template/board.h
@@ -0,0 +1,172 @@
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#include "fsl_port.h"
14/*******************************************************************************
15 * Definitions
16 ******************************************************************************/
17/*! @brief The board name */
18#define BOARD_NAME "FRDM-K32L3A6"
19
20/* The UART to use for debug messages. */
21#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
22#define BOARD_DEBUG_UART_BAUDRATE 115200U
23#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART0
24#define BOARD_DEBUG_UART_INSTANCE 0U
25#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetIpFreq(kCLOCK_Lpuart0)
26#define BOARD_UART_IRQ LPUART0_IRQn
27#define BOARD_UART_IRQ_HANDLER LPUART0_IRQHandler
28
29/* @Brief Board accelerator sensor configuration */
30#define BOARD_ACCEL_I2C_BASEADDR LPI2C3
31#define BOARD_ACCEL_I2C_CLOCK_FREQ (CLOCK_GetIpFreq(kCLOCK_Lpi2c3))
32
33/* Definitions for eRPC MU transport layer */
34#if defined(FSL_FEATURE_MU_SIDE_A)
35#define MU_BASE MUA
36#define MU_IRQ MUA_IRQn
37#define MU_IRQ_HANDLER MUA_IRQHandler
38#endif
39#if defined(FSL_FEATURE_MU_SIDE_B)
40#define MU_BASE MUB
41#define MU_IRQ MUB_IRQn
42#define MU_IRQ_HANDLER MUB_IRQHandler
43#endif
44#define MU_IRQ_PRIORITY (2)
45
46/*! @brief Define the port interrupt number for the board switches */
47#ifndef BOARD_SW2_GPIO
48#define BOARD_SW2_GPIO GPIOA
49#endif
50#ifndef BOARD_SW2_PORT
51#define BOARD_SW2_PORT PORTA
52#endif
53#ifndef BOARD_SW2_GPIO_PIN
54#define BOARD_SW2_GPIO_PIN 0U
55#endif
56#define BOARD_SW2_IRQ PORTA_IRQn
57#define BOARD_SW2_IRQ_HANDLER PORTA_IRQHandler
58#define BOARD_SW2_NAME "SW2"
59
60/* Board led color mapping */
61#ifndef BOARD_LED_RED_GPIO
62#define BOARD_LED_RED_GPIO GPIOA
63#endif
64#ifndef BOARD_LED_RED_GPIO_PIN
65#define BOARD_LED_RED_GPIO_PIN 24U
66#endif
67
68/*! @brief The TPM channel used for board */
69#define BOARD_TPM_CHANNEL 0U
70
71#define LOGIC_LED_ON 1U
72#define LOGIC_LED_OFF 0U
73#ifndef BOARD_LED1_GPIO
74#define BOARD_LED1_GPIO GPIOA
75#endif
76#ifndef BOARD_LED1_GPIO_PIN
77#define BOARD_LED1_GPIO_PIN 24U
78#endif
79#ifndef BOARD_LED2_GPIO
80#define BOARD_LED2_GPIO GPIOA
81#endif
82#ifndef BOARD_LED2_GPIO_PIN
83#define BOARD_LED2_GPIO_PIN 23U
84#endif
85#ifndef BOARD_LED3_GPIO
86#define BOARD_LED3_GPIO GPIOA
87#endif
88#ifndef BOARD_LED3_GPIO_PIN
89#define BOARD_LED3_GPIO_PIN 22U
90#endif
91
92#ifndef BOARD_LED4_GPIO
93#define BOARD_LED4_GPIO GPIOE
94#endif
95#ifndef BOARD_LED4_GPIO_PIN
96#define BOARD_LED4_GPIO_PIN 0U
97#endif
98
99#define LED1_INIT(output) \
100 GPIO_PinWrite(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PIN, output); \
101 BOARD_LED1_GPIO->PDDR |= (1U << BOARD_LED1_GPIO_PIN) /*!< Enable target LED1 */
102#define LED1_ON() GPIO_PortSet(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn on target LED1 */
103#define LED1_OFF() GPIO_PortClear(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn off target LED1 */
104#define LED1_TOGGLE() GPIO_PortToggle(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Toggle on target LED1 */
105
106#define LED2_INIT(output) \
107 GPIO_PinWrite(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PIN, output); \
108 BOARD_LED2_GPIO->PDDR |= (1U << BOARD_LED2_GPIO_PIN) /*!< Enable target LED2 */
109#define LED2_ON() GPIO_PortSet(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn on target LED2 */
110#define LED2_OFF() GPIO_PortClear(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn off target LED2 */
111#define LED2_TOGGLE() GPIO_PortToggle(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Toggle on target LED2 */
112
113#define LED3_INIT(output) \
114 GPIO_PinWrite(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PIN, output); \
115 BOARD_LED3_GPIO->PDDR |= (1U << BOARD_LED3_GPIO_PIN) /*!< Enable target LED3 */
116#define LED3_ON() GPIO_PortSet(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn on target LED3 */
117#define LED3_OFF() GPIO_PortClear(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn off target LED3 */
118#define LED3_TOGGLE() GPIO_PortToggle(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Toggle on target LED3 */
119
120#define LED4_INIT(output) \
121 GPIO_PinWrite(BOARD_LED4_GPIO, BOARD_LED4_GPIO_PIN, output); \
122 BOARD_LED4_GPIO->PDDR |= (1U << BOARD_LED4_GPIO_PIN)
123#define LED4_ON() GPIO_PortSet(BOARD_LED4_GPIO, 1U << BOARD_LED4_GPIO_PIN) /*!< Turn on target LED */
124#define LED4_OFF() GPIO_PortClear(BOARD_LED4_GPIO, 1U << BOARD_LED4_GPIO_PIN) /*!< Turn off target LED */
125#define LED4_TOGGLE() GPIO_PortToggle(BOARD_LED4_GPIO, 1U << BOARD_LED4_GPIO_PIN) /*!< Toggle on target LED */
126
127#define LLWU_SW_GPIO BOARD_SW2_GPIO
128#define LLWU_SW_PORT BOARD_SW2_PORT
129#define LLWU_SW_GPIO_PIN BOARD_SW2_GPIO_PIN
130#define LLWU_SW_IRQ BOARD_SW2_IRQ
131#define LLWU_SW_IRQ_HANDLER BOARD_SW2_IRQ_HANDLER
132#define LLWU_SW_NAME BOARD_SW2_NAME
133
134#ifndef BOARD_SPI_FLASH_CS_GPIO
135#define BOARD_SPI_FLASH_CS_GPIO GPIOB
136#endif
137#ifndef BOARD_SPI_FLASH_CS_GPIO_PIN
138#define BOARD_SPI_FLASH_CS_GPIO_PIN 22U
139#endif
140#if defined(__cplusplus)
141extern "C" {
142#endif /* __cplusplus */
143
144/*******************************************************************************
145 * API
146 ******************************************************************************/
147
148void BOARD_InitDebugConsole(void);
149#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
150void BOARD_LPI2C_Init(LPI2C_Type *base, uint32_t clkSrc_Hz);
151status_t BOARD_LPI2C_Send(LPI2C_Type *base,
152 uint8_t deviceAddress,
153 uint32_t subAddress,
154 uint8_t subaddressSize,
155 uint8_t *txBuff,
156 uint8_t txBuffSize);
157status_t BOARD_LPI2C_Receive(LPI2C_Type *base,
158 uint8_t deviceAddress,
159 uint32_t subAddress,
160 uint8_t subaddressSize,
161 uint8_t *rxBuff,
162 uint8_t rxBuffSize);
163void BOARD_Accel_I2C_Init(void);
164status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff);
165status_t BOARD_Accel_I2C_Receive(
166 uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
167#endif /* SDK_I2C_BASED_COMPONENT_USED */
168#if defined(__cplusplus)
169}
170#endif /* __cplusplus */
171
172#endif /* _BOARD_H_ */