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 "HVP-KV11Z75M" 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) UART1 25 #define BOARD_DEBUG_UART_INSTANCE 1U 26 #define BOARD_DEBUG_UART_CLKSRC BUS_CLK 27 #define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetBusClkFreq() 28 #define BOARD_UART_IRQ UART1_IRQn 29 #define BOARD_UART_IRQ_HANDLER UART1_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_ADC_USE_ALT_VREF 1U 37 38 /* Board led color mapping */ 39 #define LOGIC_LED_ON 1U 40 #define LOGIC_LED_OFF 0U 41 #ifndef BOARD_LED_RED_GPIO 42 #define BOARD_LED_RED_GPIO GPIOC 43 #endif 44 #define BOARD_LED_RED_GPIO_PORT PORTC 45 #ifndef BOARD_LED_RED_GPIO_PIN 46 #define BOARD_LED_RED_GPIO_PIN 3U 47 #endif 48 #ifndef BOARD_LED_GREEN_GPIO 49 #define BOARD_LED_GREEN_GPIO GPIOD 50 #endif 51 #define BOARD_LED_GREEN_GPIO_PORT PORTD 52 #ifndef BOARD_LED_GREEN_GPIO_PIN 53 #define BOARD_LED_GREEN_GPIO_PIN 2U 54 #endif 55 56 #define LED_RED_INIT(output) \ 57 GPIO_PinWrite(BOARD_LED_RED_GPIO, BOARD_LED_RED_GPIO_PIN, output); \ 58 BOARD_LED_RED_GPIO->PDDR |= (1U << BOARD_LED_RED_GPIO_PIN) /*!< Enable target LED_RED */ 59 #define LED_RED_ON() GPIO_PortClear(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn on target LED_RED */ 60 #define LED_RED_OFF() GPIO_PortSet(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Turn off target LED_RED */ 61 #define LED_RED_TOGGLE() \ 62 GPIO_PortToggle(BOARD_LED_RED_GPIO, 1U << BOARD_LED_RED_GPIO_PIN) /*!< Toggle on target LED_RED */ 63 64 #define LED_GREEN_INIT(output) \ 65 GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \ 66 BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */ 67 #define LED_GREEN_ON() \ 68 GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */ 69 #define LED_GREEN_OFF() \ 70 GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */ 71 #define LED_GREEN_TOGGLE() \ 72 GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */ 73 74 #if defined(__cplusplus) 75 extern "C" { 76 #endif /* __cplusplus */ 77 78 /******************************************************************************* 79 * API 80 ******************************************************************************/ 81 82 void BOARD_InitDebugConsole(void); 83 84 #if defined(__cplusplus) 85 } 86 #endif /* __cplusplus */ 87 88 #endif /* _BOARD_H_ */ 89