aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h141
1 files changed, 141 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h
new file mode 100644
index 000000000..3e3510867
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso845max/project_template/board.h
@@ -0,0 +1,141 @@
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 "LPCXPRESSO845MAX"
20
21#define BOARD_EXTCLKINRATE (0)
22
23/*! @brief The UART to use for debug messages. */
24#define BOARD_DEBUG_USART_TYPE kSerialPort_Uart
25#define BOARD_DEBUG_USART_BASEADDR (uint32_t) USART0
26#define BOARD_DEBUG_USART_INSTANCE 0U
27#define BOARD_DEBUG_USART_CLK_FREQ CLOCK_GetMainClkFreq()
28#define BOARD_DEBUG_USART_CLK_ATTACH kUART0_Clk_From_MainClk
29#define BOARD_DEBUG_USART_RST kUART0_RST_N_SHIFT_RSTn
30#define BOARD_UART_IRQ USART0_IRQn
31#define BOARD_UART_IRQ_HANDLER USART0_IRQHandler
32
33#ifndef BOARD_DEBUG_USART_BAUDRATE
34#define BOARD_DEBUG_USART_BAUDRATE 9600
35#endif /* BOARD_DEBUG_UART_BAUDRATE */
36
37/*! @brief Board led mapping */
38#define LOGIC_LED_ON 0U
39#define LOGIC_LED_OFF 1U
40
41/* LED_GREEN */
42#ifndef BOARD_LED_GREEN_GPIO
43#define BOARD_LED_GREEN_GPIO GPIO
44#endif
45#define BOARD_LED_GREEN_GPIO_PORT 0U
46#ifndef BOARD_LED_GREEN_GPIO_PIN
47#define BOARD_LED_GREEN_GPIO_PIN 0U
48#endif
49
50#define LED_GREEN_INIT(output) \
51 GPIO_PortInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT); \
52 GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, \
53 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}); /*!< Enable target LED_GREEN */
54#define LED_GREEN_ON() \
55 GPIO_PortClear(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
56 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN \ \ \ \ \
57 */
58#define LED_GREEN_OFF() \
59 GPIO_PortSet(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
60 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN \ \ \ \ \
61 */
62#define LED_GREEN_TOGGLE() \
63 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \
64 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
65
66/* LED_BLUE */
67#ifndef BOARD_LED_BLUE_GPIO
68#define BOARD_LED_BLUE_GPIO GPIO
69#endif
70#define BOARD_LED_BLUE_GPIO_PORT 1U
71#ifndef BOARD_LED_BLUE_GPIO_PIN
72#define BOARD_LED_BLUE_GPIO_PIN 15U
73#endif
74
75#ifndef BOARD_SW2_GPIO
76#define BOARD_SW2_GPIO GPIO
77#endif
78#define BOARD_SW2_GPIO_PORT 0U
79#ifndef BOARD_SW2_GPIO_PIN
80#define BOARD_SW2_GPIO_PIN 4U
81#endif
82#define BOARD_SW2_NAME "SW2"
83#define BOARD_SW2_IRQ PIN_INT0_IRQn
84#define BOARD_SW2_IRQ_HANDLER PIN_INT0_IRQHandler
85
86#define LED_BLUE_INIT(output) \
87 GPIO_PortInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT); \
88 GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, \
89 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}); /*!< Enable target LED_GREEN */
90#define LED_BLUE_ON() \
91 GPIO_PortClear(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
92 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE \ \ \ \ \
93 */
94#define LED_BLUE_OFF() \
95 GPIO_PortSet(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
96 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE \ \ \ \ \
97 */
98#define LED_BLUE_TOGGLE() \
99 GPIO_PortToggle(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \
100 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */
101
102/* LED_RED */
103#ifndef BOARD_LED_RED_GPIO
104#define BOARD_LED_RED_GPIO GPIO
105#endif
106#define BOARD_LED_RED_GPIO_PORT 0U
107#ifndef BOARD_LED_RED_GPIO_PIN
108#define BOARD_LED_RED_GPIO_PIN 12U
109#endif
110
111#define LED_RED_INIT(output) \
112 GPIO_PortInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT); \
113 GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, \
114 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}); /*!< Enable target LED_GREEN */
115#define LED_RED_ON() \
116 GPIO_PortClear(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
117 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED \ \ \ \ \
118 */
119#define LED_RED_OFF() \
120 GPIO_PortSet(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
121 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED \ \ \ \ \
122 */
123#define LED_RED_TOGGLE() \
124 GPIO_PortToggle(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \
125 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
126
127#if defined(__cplusplus)
128extern "C" {
129#endif /* __cplusplus */
130
131/*******************************************************************************
132 * API
133 ******************************************************************************/
134
135status_t BOARD_InitDebugConsole(void);
136
137#if defined(__cplusplus)
138}
139#endif /* __cplusplus */
140
141#endif /* _BOARD_H_ */