aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h
new file mode 100644
index 000000000..ddb5316b1
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK22F51212/project_template/board.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (c) 2015, 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_gpio.h"
14
15/*******************************************************************************
16 * Definitions
17 ******************************************************************************/
18/*! @brief The board name */
19#define BOARD_NAME "USB-KW40Z-K22F"
20
21/*! @brief The UART to use for debug messages. */
22#define BOARD_USE_UART
23#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART
24#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART1
25#define BOARD_DEBUG_UART_INSTANCE 1U
26#define BOARD_DEBUG_UART_CLKSRC SYS_CLK
27#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()
28#define BOARD_UART_IRQ UART1_RX_TX_IRQn
29#define BOARD_UART_IRQ_HANDLER UART1_RX_TX_IRQHandler
30
31#ifndef BOARD_DEBUG_UART_BAUDRATE
32#define BOARD_DEBUG_UART_BAUDRATE 115200
33#endif /* BOARD_DEBUG_UART_BAUDRATE */
34
35/*! @brief The bubble level demo information */
36#define BOARD_FXOS8700_ADDR 0x1C
37#define BOARD_ACCEL_ADDR BOARD_FXOS8700_ADDR
38#define BOARD_ACCEL_BAUDRATE 100
39#define BOARD_ACCEL_I2C_BASEADDR I2C0
40
41/*! @brief The i2c instance used for i2c connection by default */
42#define BOARD_I2C_BASEADDR I2C0
43
44/*! @brief The CMP instance/channel used for board. */
45#define BOARD_CMP_BASEADDR CMP0
46#define BOARD_CMP_CHANNEL 0U
47
48/*! @brief The rtc instance used for board. */
49#define BOARD_RTC_FUNC_BASEADDR RTC
50
51/* Board led color mapping */
52#define LOGIC_LED_ON 0U
53#define LOGIC_LED_OFF 1U
54#ifndef BOARD_LED_RED_GPIO
55#define BOARD_LED_RED_GPIO GPIOA
56#endif
57#define BOARD_LED_RED_GPIO_PORT PORTA
58#ifndef BOARD_LED_RED_GPIO_PIN
59#define BOARD_LED_RED_GPIO_PIN 1U
60#endif
61#ifndef BOARD_LED_GREEN_GPIO
62#define BOARD_LED_GREEN_GPIO GPIOA
63#endif
64#define BOARD_LED_GREEN_GPIO_PORT PORTA
65#ifndef BOARD_LED_GREEN_GPIO_PIN
66#define BOARD_LED_GREEN_GPIO_PIN 2U
67#endif
68#ifndef BOARD_LED_BLUE_GPIO
69#define BOARD_LED_BLUE_GPIO GPIOD
70#endif
71#define BOARD_LED_BLUE_GPIO_PORT PORTD
72#ifndef BOARD_LED_BLUE_GPIO_PIN
73#define BOARD_LED_BLUE_GPIO_PIN 5U
74#endif
75
76#define LED_RED_INIT(output) \
77 GPIO_PinInit(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, \
78 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_RED */
79#define LED_RED_ON() \
80 GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */
81#define LED_RED_OFF() \
82 GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
83#define LED_RED_TOGGLE() \
84 GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
85
86#define LED_GREEN_INIT(output) \
87 GPIO_PinInit(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, \
88 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_GREEN */
89#define LED_GREEN_ON() \
90 GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
91#define LED_GREEN_OFF() \
92 GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
93#define LED_GREEN_TOGGLE() \
94 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
95
96#define LED_BLUE_INIT(output) \
97 GPIO_PinInit(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, \
98 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED_BLUE */
99#define LED_BLUE_ON() \
100 GPIO_PortClear(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */
101#define LED_BLUE_OFF() \
102 GPIO_PortSet(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */
103#define LED_BLUE_TOGGLE() \
104 GPIO_PortToggle(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */
105
106/* The USB_CDC to use for debug messages. */
107#ifndef BOARD_DEBUG_USBCDC_INSTANCE
108#define BOARD_DEBUG_USBCDC_INSTANCE 1
109#endif
110#ifndef BOARD_DEBUG_USBCDC_BAUD
111#define BOARD_DEBUG_USBCDC_BAUD 115200
112#endif
113
114#if defined(__cplusplus)
115extern "C" {
116#endif /* __cplusplus */
117
118/*******************************************************************************
119 * API
120 ******************************************************************************/
121
122void BOARD_InitDebugConsole(void);
123
124#if defined(__cplusplus)
125}
126#endif /* __cplusplus */
127
128#endif /* _BOARD_H_ */