aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h178
1 files changed, 178 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h
new file mode 100644
index 000000000..ce5dcfa20
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso51u68/board.h
@@ -0,0 +1,178 @@
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2018 NXP
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_common.h"
13#include "fsl_gpio.h"
14
15/*******************************************************************************
16 * Definitions
17 ******************************************************************************/
18/*! @brief The board name */
19#define BOARD_NAME "LPCXPRESSO51U68"
20
21#define BOARD_EXTCLKINRATE (0)
22
23/*! @brief The UART to use for debug messages. */
24#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
25#define BOARD_DEBUG_UART_BASEADDR (uint32_t) USART0
26#define BOARD_DEBUG_UART_INSTANCE 0U
27#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0)
28#define BOARD_DEBUG_UART_CLK_ATTACH kFRO12M_to_FLEXCOMM0
29#define BOARD_DEBUG_UART_RST kFC0_RST_SHIFT_RSTn
30#define BOARD_UART_IRQ FLEXCOMM0_IRQn
31#define BOARD_UART_IRQ_HANDLER FLEXCOMM0_IRQHandler
32
33#define BOARD_DEBUG_SPI_CLK_FREQ 12000000
34
35#ifndef BOARD_DEBUG_UART_BAUDRATE
36#define BOARD_DEBUG_UART_BAUDRATE 115200
37#endif /* BOARD_DEBUG_UART_BAUDRATE */
38
39#ifndef BOARD_LED_RED_GPIO
40#define BOARD_LED_RED_GPIO GPIO
41#endif
42#define BOARD_LED_RED_GPIO_PORT 0U
43#ifndef BOARD_LED_RED_GPIO_PIN
44#define BOARD_LED_RED_GPIO_PIN 29U
45#endif
46#ifndef BOARD_LED_GREEN_GPIO
47#define BOARD_LED_GREEN_GPIO GPIO
48#endif
49#define BOARD_LED_GREEN_GPIO_PORT 1U
50#ifndef BOARD_LED_GREEN_GPIO_PIN
51#define BOARD_LED_GREEN_GPIO_PIN 10U
52#endif
53#ifndef BOARD_LED_BLUE_GPIO
54#define BOARD_LED_BLUE_GPIO GPIO
55#endif
56#define BOARD_LED_BLUE_GPIO_PORT 1U
57#ifndef BOARD_LED_BLUE_GPIO_PIN
58#define BOARD_LED_BLUE_GPIO_PIN 9U
59#endif
60
61#ifndef BOARD_SW1_GPIO
62#define BOARD_SW1_GPIO GPIO
63#endif
64#define BOARD_SW1_GPIO_PORT 0U
65#ifndef BOARD_SW1_GPIO_PIN
66#define BOARD_SW1_GPIO_PIN 24U
67#endif
68#define BOARD_SW1_NAME "SW1"
69#define BOARD_SW3_IRQ PIN_INT0_IRQn
70#define BOARD_SW3_IRQ_HANDLER PIN_INT0_IRQHandler
71
72#ifndef BOARD_SW2_GPIO
73#define BOARD_SW2_GPIO GPIO
74#endif
75#define BOARD_SW2_GPIO_PORT 0U
76#ifndef BOARD_SW2_GPIO_PIN
77#define BOARD_SW2_GPIO_PIN 31U
78#endif
79#define BOARD_SW2_NAME "SW2"
80#define BOARD_SW3_IRQ PIN_INT0_IRQn
81#define BOARD_SW3_IRQ_HANDLER PIN_INT0_IRQHandler
82
83#ifndef BOARD_SW3_GPIO
84#define BOARD_SW3_GPIO GPIO
85#endif
86#define BOARD_SW3_GPIO_PORT 0U
87#ifndef BOARD_SW3_GPIO_PIN
88#define BOARD_SW3_GPIO_PIN 4U
89#endif
90#define BOARD_SW3_NAME "SW3"
91#define BOARD_SW3_IRQ PIN_INT0_IRQn
92#define BOARD_SW3_IRQ_HANDLER PIN_INT0_IRQHandler
93#define BOARD_SW3_GPIO_PININT_INDEX 0
94
95#define BOARD_ARDUINO_INT_IRQ (GINT0_IRQn)
96#define BOARD_ARDUINO_I2C_IRQ (FLEXCOMM4_IRQn)
97#define BOARD_ARDUINO_I2C_INDEX (4)
98/* Board led color mapping */
99#define LOGIC_LED_ON 0U
100#define LOGIC_LED_OFF 1U
101
102#define LED_RED_INIT(output) \
103 GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, \
104 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_RED */
105#define LED_RED_ON() \
106 GPIO_PortClear(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
107 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */
108#define LED_RED_OFF() \
109 GPIO_PortSet(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
110 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
111#define LED_RED_TOGGLE() \
112 GPIO_PortToggle(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
113 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
114
115#define LED_GREEN_INIT(output) \
116 GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, \
117 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_GREEN */
118#define LED_GREEN_ON() \
119 GPIO_PortClear(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
120 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
121#define LED_GREEN_OFF() \
122 GPIO_PortSet(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
123 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
124#define LED_GREEN_TOGGLE() \
125 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
126 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
127
128#define LED_BLUE_INIT(output) \
129 GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, \
130 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_BLUE */
131#define LED_BLUE_ON() \
132 GPIO_PortClear(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
133 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */
134#define LED_BLUE_OFF() \
135 GPIO_PortSet(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
136 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */
137#define LED_BLUE_TOGGLE() \
138 GPIO_PortToggle(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
139 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */
140
141#define BOARD_CODEC_I2C_BASEADDR I2C4
142#define BOARD_CODEC_I2C_INSTANCE 4U
143#define BOARD_CODEC_I2C_CLOCK_FREQ 12000000
144
145#if defined(__cplusplus)
146extern "C" {
147#endif /* __cplusplus */
148
149/*******************************************************************************
150 * API
151 ******************************************************************************/
152
153status_t BOARD_InitDebugConsole(void);
154#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
155void BOARD_I2C_Init(I2C_Type *base, uint32_t clkSrc_Hz);
156status_t BOARD_I2C_Send(I2C_Type *base,
157 uint8_t deviceAddress,
158 uint32_t subAddress,
159 uint8_t subaddressSize,
160 uint8_t *txBuff,
161 uint8_t txBuffSize);
162status_t BOARD_I2C_Receive(I2C_Type *base,
163 uint8_t deviceAddress,
164 uint32_t subAddress,
165 uint8_t subaddressSize,
166 uint8_t *rxBuff,
167 uint8_t rxBuffSize);
168void BOARD_Codec_I2C_Init(void);
169status_t BOARD_Codec_I2C_Send(
170 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize);
171status_t BOARD_Codec_I2C_Receive(
172 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
173#endif /* SDK_I2C_BASED_COMPONENT_USED */
174#if defined(__cplusplus)
175}
176#endif /* __cplusplus */
177
178#endif /* _BOARD_H_ */