2 * @brief Common board API functions
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __BOARD_API_H_
\r
33 #define __BOARD_API_H_
\r
35 #include "lpc_types.h"
\r
42 /** @defgroup BOARD_COMMON_API BOARD: Common board functions
\r
43 * @ingroup BOARD_Common
\r
44 * This file contains common board definitions that are shared across
\r
45 * boards and devices. All of these functions do not need to be
\r
46 * impemented for a specific board, but if they are implemented, they
\r
47 * should use this API standard.
\r
52 * @brief Set up and initialize all required blocks and functions related to the board hardware.
\r
55 void Board_Init(void);
\r
58 * @brief Initializes board UART for output, required for printf redirection
\r
61 void Board_Debug_Init(void);
\r
64 * @brief Sends a single character on the UART, required for printf redirection
\r
65 * @param ch : character to send
\r
68 void Board_UARTPutChar(char ch);
\r
71 * @brief Get a single character from the UART, required for scanf input
\r
72 * @return EOF if not character was received, or character value
\r
74 int Board_UARTGetChar(void);
\r
77 * @brief Prints a string to the UART
\r
78 * @param str : Terminated string to output
\r
81 void Board_UARTPutSTR(char *str);
\r
84 * @brief Sets the state of a board LED to on or off
\r
85 * @param LEDNumber : LED number to set state for
\r
86 * @param State : true for on, false for off
\r
89 void Board_LED_Set(uint8_t LEDNumber, bool State);
\r
92 * @brief Returns the current state of a board LED
\r
93 * @param LEDNumber : LED number to set state for
\r
94 * @return true if the LED is on, otherwise false
\r
96 bool Board_LED_Test(uint8_t LEDNumber);
\r
99 * @brief Toggles the current state of a board LED
\r
100 * @param LEDNumber : LED number to change state for
\r
103 STATIC INLINE void Board_LED_Toggle(uint8_t LEDNumber)
\r
105 Board_LED_Set(LEDNumber, !Board_LED_Test(LEDNumber));
\r
109 * @brief Current system clock rate, mainly used for sysTick
\r
111 extern uint32_t SystemCoreClock;
\r
114 * @brief Update system core clock rate, should be called if the
\r
115 * system has a clock rate change
\r
118 void SystemCoreClockUpdate(void);
\r
121 * @brief Turn on Board LCD Backlight
\r
122 * @param Intensity : Backlight intensity (0 = off, >=1 = on)
\r
124 * @note On boards where a GPIO is used to control backlight on/off state, a '0' or '1'
\r
125 * value will turn off or on the backlight. On some boards, a non-0 value will
\r
126 * control backlight intensity via a PWN. For PWM systems, the intensity value
\r
127 * is a percentage value between 0 and 100%.
\r
129 void Board_SetLCDBacklight(uint8_t Intensity);
\r
132 * @brief Function prototype for a MS delay function. Board layers or example code may
\r
133 * define this function as needed.
\r
135 typedef void (*p_msDelay_func_t)(uint32_t);
\r
137 /* The DEBUG* functions are selected based on system configuration.
\r
138 Code that uses the DEBUG* functions will have their I/O routed to
\r
139 the UART, semihosting, or nowhere. */
\r
140 #if defined(DEBUG_ENABLE)
\r
141 #if defined(DEBUG_SEMIHOSTING)
\r
142 #define DEBUGINIT()
\r
143 #define DEBUGOUT(...) printf(__VA_ARGS__)
\r
144 #define DEBUGSTR(str) printf(str)
\r
145 #define DEBUGIN() (int) EOF
\r
148 #define DEBUGINIT() Board_Debug_Init()
\r
149 #define DEBUGOUT(...) printf(__VA_ARGS__)
\r
150 #define DEBUGSTR(str) Board_UARTPutSTR(str)
\r
151 #define DEBUGIN() Board_UARTGetChar()
\r
152 #endif /* defined(DEBUG_SEMIHOSTING) */
\r
155 #define DEBUGINIT()
\r
156 #define DEBUGOUT(...)
\r
157 #define DEBUGSTR(str)
\r
158 #define DEBUGIN() (int) EOF
\r
159 #endif /* defined(DEBUG_ENABLE) */
\r
169 #endif /* __BOARD_API_H_ */
\r