aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h184
1 files changed, 184 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h
new file mode 100644
index 000000000..a7cb57d2a
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/frdmkv11z/board.h
@@ -0,0 +1,184 @@
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2018 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 "FRDM-KV11Z"
20
21/*! @brief The UART to use for debug messages. */
22#define BOARD_USE_UART
23#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
24#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART0
25#define BOARD_DEBUG_UART_INSTANCE 0U
26#define BOARD_DEBUG_UART_CLKSRC SYS_CLK
27#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()
28#define BOARD_UART_IRQ UART0_IRQn
29#define BOARD_UART_IRQ_HANDLER UART0_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 instances of peripherals used for dac_adc_demo */
36#define BOARD_DAC_DEMO_DAC_BASEADDR DAC0
37#define BOARD_DAC_DEMO_ADC_BASEADDR ADC1
38#define BOARD_DAC_DEMO_ADC_CHANNEL 4U
39#define BOARD_ADC_USE_ALT_VREF 1U
40
41/*! @brief The i2c instance used for board. */
42#define BOARD_I2C_COMM_BASEADDR I2C0
43
44/*! @brief The i2c instance used for i2c connection by default */
45#define BOARD_I2C_BASEADDR I2C0
46
47/*! @brief The bubble level demo information */
48#define BOARD_FXOS8700_ADDR 0x1D
49#define BOARD_ACCEL_ADDR BOARD_FXOS8700_ADDR
50#define BOARD_ACCEL_BAUDRATE 100
51#define BOARD_ACCEL_I2C_BASEADDR I2C0
52#define BOARD_ACCEL_I2C_CLOCK_FREQ CLOCK_GetFreq(I2C0_CLK_SRC)
53
54/*! @brief ADC1 input channel for board. */
55#define BOARD_ADC_HW_TRIGGER_DAC_BASEADDR DAC0
56#define BOARD_ADC_HW_TRIGGER_ADC_BASEADDR ADC1
57#define BOARD_ADC_HW_TRIGGER_CHANNEL 4U
58
59#define BOARD_CAN_BASEADDR CAN0
60
61/*! @brief The dspi instance used for board. */
62#define BOARD_DSPI_BASEADDR SPI0
63
64/*! @brief The CMP instance used for board. */
65#define BOARD_CMP_BASEADDR CMP0
66
67/*! @brief The CMP channel used for board. */
68#define BOARD_CMP_CHANNEL 0U
69
70/*! @brief Define the port interrupt number for the board switches */
71#ifndef BOARD_SW2_GPIO
72#define BOARD_SW2_GPIO GPIOB
73#endif
74#ifndef BOARD_SW2_PORT
75#define BOARD_SW2_PORT PORTB
76#endif
77#ifndef BOARD_SW2_GPIO_PIN
78#define BOARD_SW2_GPIO_PIN 0U
79#endif
80#define BOARD_SW2_IRQ PORTB_PORTC_PORTD_PORTE_IRQn
81#define BOARD_SW2_IRQ_HANDLER PORTB_PORTC_PORTD_PORTE_IRQHandler
82#define BOARD_SW2_NAME "SW2"
83
84#ifndef BOARD_SW3_GPIO
85#define BOARD_SW3_GPIO GPIOA
86#endif
87#ifndef BOARD_SW3_PORT
88#define BOARD_SW3_PORT PORTA
89#endif
90#ifndef BOARD_SW3_GPIO_PIN
91#define BOARD_SW3_GPIO_PIN 4U
92#endif
93#define BOARD_SW3_IRQ PORTA_IRQn
94#define BOARD_SW3_IRQ_HANDLER PORTA_IRQHandler
95#define BOARD_SW3_NAME "SW3"
96
97/* Board led color mapping */
98#define LOGIC_LED_ON 0U
99#define LOGIC_LED_OFF 1U
100#ifndef BOARD_LED_RED_GPIO
101#define BOARD_LED_RED_GPIO GPIOD
102#endif
103#define BOARD_LED_RED_GPIO_PORT PORTD
104#ifndef BOARD_LED_RED_GPIO_PIN
105#define BOARD_LED_RED_GPIO_PIN 6U
106#endif
107#ifndef BOARD_LED_GREEN_GPIO
108#define BOARD_LED_GREEN_GPIO GPIOE
109#endif
110#define BOARD_LED_GREEN_GPIO_PORT PORTE
111#ifndef BOARD_LED_GREEN_GPIO_PIN
112#define BOARD_LED_GREEN_GPIO_PIN 29U
113#endif
114#ifndef BOARD_LED_BLUE_GPIO
115#define BOARD_LED_BLUE_GPIO GPIOE
116#endif
117#define BOARD_LED_BLUE_GPIO_PORT PORTE
118#ifndef BOARD_LED_BLUE_GPIO_PIN
119#define BOARD_LED_BLUE_GPIO_PIN 25U
120#endif
121
122#define LED_RED_INIT(output) \
123 GPIO_PinWrite(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, output); \
124 BOARD_LED_RED_GPIO->PDDR |= (1U << BOARD_LED_RED_GPIO_PIN) /*!< Enable target LED_RED */
125#define LED_RED_ON() GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */
126#define LED_RED_OFF() GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */
127#define LED_RED_TOGGLE() \
128 GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */
129
130#define LED_GREEN_INIT(output) \
131 GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \
132 BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */
133#define LED_GREEN_ON() \
134 GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */
135#define LED_GREEN_OFF() \
136 GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */
137#define LED_GREEN_TOGGLE() \
138 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */
139
140#define LED_BLUE_INIT(output) \
141 GPIO_PinWrite(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, output); \
142 BOARD_LED_BLUE_GPIO->PDDR |= (1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Enable target LED_BLUE */
143#define LED_BLUE_ON() \
144 GPIO_PortClear(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE \
145 */
146#define LED_BLUE_OFF() \
147 GPIO_PortSet(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE \
148 */
149#define LED_BLUE_TOGGLE() GPIO_PortToggle(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN)
150
151#if defined(__cplusplus)
152extern "C" {
153#endif /* __cplusplus */
154
155/*******************************************************************************
156 * API
157 ******************************************************************************/
158
159void BOARD_InitDebugConsole(void);
160#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
161void BOARD_I2C_Init(I2C_Type *base, uint32_t clkSrc_Hz);
162status_t BOARD_I2C_Send(I2C_Type *base,
163 uint8_t deviceAddress,
164 uint32_t subAddress,
165 uint8_t subaddressSize,
166 uint8_t *txBuff,
167 uint8_t txBuffSize);
168status_t BOARD_I2C_Receive(I2C_Type *base,
169 uint8_t deviceAddress,
170 uint32_t subAddress,
171 uint8_t subaddressSize,
172 uint8_t *rxBuff,
173 uint8_t rxBuffSize);
174void BOARD_Accel_I2C_Init(void);
175status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff);
176status_t BOARD_Accel_I2C_Receive(
177 uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
178#endif /* SDK_I2C_BASED_COMPONENT_USED */
179
180#if defined(__cplusplus)
181}
182#endif /* __cplusplus */
183
184#endif /* _BOARD_H_ */