diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/LPC54608/project_template/board.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/devices/LPC54608/project_template/board.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54608/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54608/project_template/board.h new file mode 100644 index 000000000..08a9778fc --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/LPC54608/project_template/board.h | |||
@@ -0,0 +1,121 @@ | |||
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 "LPCXPRESSO54608" | ||
21 | |||
22 | #define BOARD_EXTCLKINRATE (0) | ||
23 | |||
24 | /*! @brief The UART to use for debug messages. */ | ||
25 | /* TODO: rename UART to USART */ | ||
26 | #define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM | ||
27 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) USART0 | ||
28 | #define BOARD_DEBUG_UART_INSTANCE 0U | ||
29 | #define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0) | ||
30 | #define BOARD_DEBUG_UART_CLK_ATTACH kFRO12M_to_FLEXCOMM0 | ||
31 | #define BOARD_DEBUG_UART_RST kFC0_RST_SHIFT_RSTn | ||
32 | #define BOARD_DEBUG_UART_CLKSRC kCLOCK_Flexcomm0 | ||
33 | #define BOARD_UART_IRQ_HANDLER FLEXCOMM0_IRQHandler | ||
34 | #define BOARD_UART_IRQ FLEXCOMM0_IRQn | ||
35 | /* TODO: obsolete */ | ||
36 | #define BOARD_DEBUG_SPI_CLK_FREQ 12000000 | ||
37 | |||
38 | #ifndef BOARD_DEBUG_UART_BAUDRATE | ||
39 | #define BOARD_DEBUG_UART_BAUDRATE 115200 | ||
40 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ | ||
41 | |||
42 | #ifndef BOARD_LED_RED_GPIO | ||
43 | #define BOARD_LED_RED_GPIO GPIO | ||
44 | #endif | ||
45 | #define BOARD_LED_RED_GPIO_PORT 3U | ||
46 | #ifndef BOARD_LED_RED_GPIO_PIN | ||
47 | #define BOARD_LED_RED_GPIO_PIN 14U | ||
48 | #endif | ||
49 | #ifndef BOARD_LED_GREEN_GPIO | ||
50 | #define BOARD_LED_GREEN_GPIO GPIO | ||
51 | #endif | ||
52 | #define BOARD_LED_GREEN_GPIO_PORT 2U | ||
53 | #ifndef BOARD_LED_GREEN_GPIO_PIN | ||
54 | #define BOARD_LED_GREEN_GPIO_PIN 2U | ||
55 | #endif | ||
56 | #ifndef BOARD_LED_BLUE_GPIO | ||
57 | #define BOARD_LED_BLUE_GPIO GPIO | ||
58 | #endif | ||
59 | #define BOARD_LED_BLUE_GPIO_PORT 3U | ||
60 | #ifndef BOARD_LED_BLUE_GPIO_PIN | ||
61 | #define BOARD_LED_BLUE_GPIO_PIN 3U | ||
62 | #endif | ||
63 | |||
64 | /* Board led color mapping */ | ||
65 | #define LOGIC_LED_ON 0U | ||
66 | #define LOGIC_LED_OFF 1U | ||
67 | |||
68 | #define LED_RED_INIT(output) \ | ||
69 | GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, \ | ||
70 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_RED */ | ||
71 | #define LED_RED_ON() \ | ||
72 | GPIO_PortClear(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
73 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */ | ||
74 | #define LED_RED_OFF() \ | ||
75 | GPIO_PortSet(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
76 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */ | ||
77 | #define LED_RED_TOGGLE() \ | ||
78 | GPIO_PortToggle(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PORT, \ | ||
79 | 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */ | ||
80 | |||
81 | #define LED_GREEN_INIT(output) \ | ||
82 | GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, \ | ||
83 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_GREEN */ | ||
84 | #define LED_GREEN_ON() \ | ||
85 | GPIO_PortClear(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
86 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */ | ||
87 | #define LED_GREEN_OFF() \ | ||
88 | GPIO_PortSet(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
89 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */ | ||
90 | #define LED_GREEN_TOGGLE() \ | ||
91 | GPIO_PortToggle(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PORT, \ | ||
92 | 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */ | ||
93 | |||
94 | #define LED_BLUE_INIT(output) \ | ||
95 | GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, \ | ||
96 | &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_BLUE */ | ||
97 | #define LED_BLUE_ON() \ | ||
98 | GPIO_PortClear(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
99 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */ | ||
100 | #define LED_BLUE_OFF() \ | ||
101 | GPIO_PortSet(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
102 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */ | ||
103 | #define LED_BLUE_TOGGLE() \ | ||
104 | GPIO_PortToggle(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PORT, \ | ||
105 | 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */ | ||
106 | |||
107 | #if defined(__cplusplus) | ||
108 | extern "C" { | ||
109 | #endif /* __cplusplus */ | ||
110 | |||
111 | /******************************************************************************* | ||
112 | * API | ||
113 | ******************************************************************************/ | ||
114 | |||
115 | status_t BOARD_InitDebugConsole(void); | ||
116 | |||
117 | #if defined(__cplusplus) | ||
118 | } | ||
119 | #endif /* __cplusplus */ | ||
120 | |||
121 | #endif /* _BOARD_H_ */ | ||