| BlueNRG-1 Peripherals drivers Examples

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

UART_Polling_main.c
Go to the documentation of this file.
1
2 /******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
3 * File Name : UART_Polling_main.c
4 * Author : VMA DIVISION
5 * Version : 1.0.0
6 * Date : 21-September-2015
7 * Description : Code demostrating the UART functionality
8 ********************************************************************************
9 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
10 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
11 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
12 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
13 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
14 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
15 *******************************************************************************/
16
167 /* Includes ------------------------------------------------------------------*/
168 #include "BlueNRG1.h"
169 #include "BlueNRG1_conf.h"
170 #include "SDK_EVAL_Config.h"
171
172
186 /* Private typedef -----------------------------------------------------------*/
187 /* Private define ------------------------------------------------------------*/
188 /* Private macro -------------------------------------------------------------*/
189 /* Private variables ---------------------------------------------------------*/
190 /* Private function prototypes -----------------------------------------------*/
191 /* Private functions ---------------------------------------------------------*/
192
198 int main(void)
199 {
200 uint8_t tmp;
201
202 /* System initialization function */
203 SystemInit();
204
205 /* Identify BlueNRG1 platform */
206 SdkEvalIdentification();
207
208 /* UART initialization */
209 SdkEvalComUartInit(UART_BAUDRATE);
210
211 /* Infinite loop */
212 while(1) {
213 /* Loop until the UART Receive Data Register is not empty */
214 while (UART_GetFlagStatus(UART_FLAG_RXFE) == SET);
215
216 /* Store the received byte in RxBuffer */
217 tmp = UART_ReceiveData();
218
219 /* Loop until UART DR register is empty */
220 while (UART_GetFlagStatus(UART_FLAG_TXFE) == RESET);
221
222 /* Send byte through UART */
223 UART_SendData(tmp);
224
225 }
226
227 }
228
229
230 #ifdef USE_FULL_ASSERT
231
238 void assert_failed(uint8_t* file, uint32_t line)
239 {
240 /* User can add his own implementation to report the file name and line number,
241 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
242
243 /* Infinite loop */
244 while (1)
245 {
246 }
247 }
248
249 #endif
250
263 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
main
int main(void)
Main program code.
Definition: UART_Polling_main.c:198
UART_BAUDRATE
#define UART_BAUDRATE
Definition: ADC_PDM_main.c:225