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